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
LowStar.BufferOps.fst
LowStar.BufferOps.blit
val blit : src: LowStar.Monotonic.Buffer.mbuffer a rrel1 rrel2 -> idx_src: FStar.UInt32.t -> dst: LowStar.Monotonic.Buffer.mbuffer a rel1 rel2 -> idx_dst: FStar.UInt32.t -> len: FStar.UInt32.t -> FStar.HyperStack.ST.Stack Prims.unit
let blit (#a:Type0) (#rrel1 #rel1 #rrel2 #rel2:B.srel a) = B.blit #a #rrel1 #rel1 #rrel2 #rel2
{ "file_name": "ulib/LowStar.BufferOps.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 94, "end_line": 63, "start_col": 0, "start_line": 63 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module LowStar.BufferOps (* Handy notations for LowStar.Buffer, so users can open this module instead of the whole LowStar.Buffer, to just bring these operators and notations into the scope without bringing any definition from LowStar.Buffer into the scope. *) module HS = FStar.HyperStack module HST = FStar.HyperStack.ST module U32 = FStar.UInt32 module G = FStar.Ghost module Seq = FStar.Seq module B = LowStar.Buffer module L = FStar.List.Tot inline_for_extraction unfold let op_Array_Access (#a:Type0) (#rrel #rel:B.srel a) = B.index #a #rrel #rel inline_for_extraction unfold let op_Array_Assignment (#a:Type0) (#rrel #rel:B.srel a) = B.upd #a #rrel #rel (* NOTE: DO NOT mark ( !* ) as inline_for_extraction, because it is specially treated by KaRaMeL to extract as *p instead of p[0] *) let ( !* ) (#a:Type0) (#rrel #rel:B.srel a) (p:B.mpointer a rrel rel): HST.Stack a (requires (fun h -> B.live h p)) (ensures (fun h0 x h1 -> B.live h1 p /\ x == B.get h0 p 0 /\ h1 == h0)) = B.index p 0ul (* NOTE: DO NOT mark ( *= ) as inline_for_extraction, because it is specially treated by KaRaMeL to extract as *p = v instead of p[0] = v *) let ( *= ) (#a:Type0) (#rrel #rel:B.srel a) (p:B.mpointer a rrel rel) (v:a) : HST.Stack unit (requires (fun h -> B.live h p /\ rel (B.as_seq h p) (Seq.upd (B.as_seq h p) 0 v))) (ensures (fun h0 _ h1 -> B.live h1 p /\ B.as_seq h1 p `Seq.equal` Seq.create 1 v /\ B.modifies (B.loc_buffer p) h0 h1 )) = B.upd p 0ul v // TODO: remove
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": false, "source_file": "LowStar.BufferOps.fst" }
[ { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.Ghost", "short_module": "G" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "HST" }, { "abbrev": true, "full_module": "FStar.HyperStack", "short_module": "HS" }, { "abbrev": false, "full_module": "LowStar", "short_module": null }, { "abbrev": false, "full_module": "LowStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": 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
src: LowStar.Monotonic.Buffer.mbuffer a rrel1 rrel2 -> idx_src: FStar.UInt32.t -> dst: LowStar.Monotonic.Buffer.mbuffer a rel1 rel2 -> idx_dst: FStar.UInt32.t -> len: FStar.UInt32.t -> FStar.HyperStack.ST.Stack Prims.unit
FStar.HyperStack.ST.Stack
[]
[]
[ "LowStar.Monotonic.Buffer.srel", "LowStar.Monotonic.Buffer.blit", "LowStar.Monotonic.Buffer.mbuffer", "FStar.UInt32.t", "Prims.unit", "FStar.Monotonic.HyperStack.mem", "Prims.l_and", "LowStar.Monotonic.Buffer.live", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_Addition", "FStar.UInt32.v", "LowStar.Monotonic.Buffer.length", "Prims.l_or", "LowStar.Monotonic.Buffer.loc_disjoint", "LowStar.Monotonic.Buffer.loc_buffer_from_to", "FStar.UInt32.add", "LowStar.Monotonic.Buffer.disjoint", "LowStar.Monotonic.Buffer.as_seq", "FStar.Seq.Properties.replace_subseq", "FStar.Seq.Base.slice", "LowStar.Monotonic.Buffer.modifies", "LowStar.Monotonic.Buffer.loc_buffer", "Prims.eq2", "FStar.Seq.Base.seq" ]
[]
false
true
false
false
false
let blit (#a: Type0) (#rrel1 #rel1 #rrel2 #rel2: B.srel a) =
B.blit #a #rrel1 #rel1 #rrel2 #rel2
false
Spec.K256.PointOps.fst
Spec.K256.PointOps.aff_point_store
val aff_point_store (p: aff_point) : BSeq.lbytes 64
val aff_point_store (p: aff_point) : BSeq.lbytes 64
let aff_point_store (p:aff_point) : BSeq.lbytes 64 = let (px, py) = p in let pxb = BSeq.nat_to_bytes_be 32 px in let pxy = BSeq.nat_to_bytes_be 32 py in concat #uint8 #32 #32 pxb pxy
{ "file_name": "specs/Spec.K256.PointOps.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 31, "end_line": 200, "start_col": 0, "start_line": 196 }
module Spec.K256.PointOps open FStar.Mul open Lib.IntTypes open Lib.Sequence module M = Lib.NatMod module BSeq = Lib.ByteSequence #set-options "--z3rlimit 30 --fuel 0 --ifuel 0" /// Finite field let prime : (p:pos{p = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F}) = assert_norm (24 < pow2 256 - 0x1000003D1); assert_norm (pow2 256 - 0x1000003D1 = pow2 256 - pow2 32 - pow2 9 - pow2 8 - pow2 7 - pow2 6 - pow2 4 - 1); assert_norm (pow2 256 - 0x1000003D1 = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F); pow2 256 - 0x1000003D1 let felem = x:nat{x < prime} let zero : felem = 0 let one : felem = 1 let fadd (x y:felem) : felem = (x + y) % prime let fsub (x y:felem) : felem = (x - y) % prime let fmul (x y:felem) : felem = (x * y) % prime let finv (x:felem) : felem = M.pow_mod #prime x (prime - 2) let fsqrt (x:felem) : felem = M.pow_mod #prime x ((prime + 1) / 4) let is_fodd (x:nat) : bool = x % 2 = 1 let ( +% ) = fadd let ( -% ) = fsub let ( *% ) = fmul let ( /% ) (x y:felem) = x *% finv y /// Scalar field // Group order let q : q:pos{q < pow2 256} = assert_norm (0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141 < pow2 256); 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141 let qelem = x:nat{x < q} let qadd (x y:qelem) : qelem = (x + y) % q let qmul (x y:qelem) : qelem = (x * y) % q let qinv (x:qelem) : qelem = M.pow_mod #q x (q - 2) let qnegate (x:qelem) : qelem = (- x) % q let scalar_is_high (x:qelem) : bool = x > q / 2 let ( +^ ) = qadd let ( *^ ) = qmul /// Elliptic curve let aff_point = felem & felem // Affine point let proj_point = felem & felem & felem // Projective coordinates // y * y = x * x * x + b let b : felem = 7 let is_on_curve (p:aff_point) = let x, y = p in y *% y = x *% x *% x +% b let aff_point_at_inf : aff_point = (zero, zero) // not on the curve! let point_at_inf : proj_point = (zero, one, zero) let is_aff_point_at_inf (p:aff_point) : bool = let (x, y) = p in x = zero && y = zero let is_proj_point_at_inf (p:proj_point) : bool = let (_, _, z) = p in z = zero let to_aff_point (p:proj_point) : aff_point = // if is_proj_point_at_inf p then aff_point_at_inf let (px, py, pz) = p in let zinv = finv pz in let x = px *% zinv in let y = py *% zinv in (x, y) let to_proj_point (p:aff_point) : proj_point = let (x, y) = p in (x, y, one) // Base point let g_x : felem = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 let g_y : felem = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 let g : proj_point = (g_x, g_y, one) /// Point addition in affine coordinates let aff_point_double (p:aff_point) : aff_point = let (px, py) = p in if is_aff_point_at_inf p then p else begin if py = 0 then aff_point_at_inf else begin let lambda = 3 *% px *% px /% (2 *% py) in let rx = lambda *% lambda -% px -% px in let ry = lambda *% (px -% rx) -% py in (rx, ry) end end let aff_point_add (p:aff_point) (q:aff_point) : aff_point = let (px, py) = p in let (qx, qy) = q in if is_aff_point_at_inf p then q else begin if is_aff_point_at_inf q then p else begin if p = q then aff_point_double p else begin if qx = px then aff_point_at_inf else begin let lambda = (qy -% py) /% (qx -% px) in let rx = lambda *% lambda -% px -% qx in let ry = lambda *% (px -% rx) -% py in (rx, ry) end end end end let aff_point_negate (p:aff_point) : aff_point = let x, y = p in x, (-y) % prime /// Point addition and doubling in projective coordinates let point_add (p:proj_point) (q:proj_point) : proj_point = let x1, y1, z1 = p in let x2, y2, z2 = q in let xx = x1 *% x2 in let yy = y1 *% y2 in let zz = z1 *% z2 in let xy_pairs = (x1 +% y1) *% (x2 +% y2) -% (xx +% yy) in let yz_pairs = (y1 +% z1) *% (y2 +% z2) -% (yy +% zz) in let xz_pairs = (x1 +% z1) *% (x2 +% z2) -% (xx +% zz) in let bzz3 = 3 *% b *% zz in let yy_m_bzz3 = yy -% bzz3 in let yy_p_bzz3 = yy +% bzz3 in let byz3 = 3 *% b *% yz_pairs in let xx3 = 3 *% xx in let bxx9 = 3 *% b *% xx3 in let x3 = xy_pairs *% yy_m_bzz3 -% byz3 *% xz_pairs in let y3 = yy_p_bzz3 *% yy_m_bzz3 +% bxx9 *% xz_pairs in let z3 = yz_pairs *% yy_p_bzz3 +% xx3 *% xy_pairs in x3, y3, z3 let point_double (p:proj_point) : proj_point = let x, y, z = p in let yy = y *% y in let zz = z *% z in let xy2 = 2 *% x *% y in let bzz3 = 3 *% b *% zz in let bzz9 = 3 *% bzz3 in let yy_m_bzz9 = yy -% bzz9 in let yy_p_bzz3 = yy +% bzz3 in let yy_zz = yy *% zz in let t = 24 *% b *% yy_zz in let x3 = xy2 *% yy_m_bzz9 in let y3 = yy_m_bzz9 *% yy_p_bzz3 +% t in let z3 = yy *% y *% z *% 8 in x3, y3, z3 let point_negate (p:proj_point) : proj_point = let x, y, z = p in x, (-y) % prime, z /// Point conversion between affine, projective and bytes representation let aff_point_load (b:BSeq.lbytes 64) : option aff_point = let pk_x = BSeq.nat_from_bytes_be (sub b 0 32) in let pk_y = BSeq.nat_from_bytes_be (sub b 32 32) in let is_x_valid = pk_x < prime in let is_y_valid = pk_y < prime in let is_xy_on_curve = if is_x_valid && is_y_valid then is_on_curve (pk_x, pk_y) else false in if is_xy_on_curve then Some (pk_x, pk_y) else None let load_point (b:BSeq.lbytes 64) : option proj_point = match (aff_point_load b) with | Some p -> Some (to_proj_point p) | None -> None let point_inv_bytes (b:BSeq.lbytes 64) = let px = BSeq.nat_from_bytes_be (sub b 0 32) in let py = BSeq.nat_from_bytes_be (sub b 32 32) in px < prime && py < prime && is_on_curve (px, py) let load_point_nocheck (b:BSeq.lbytes 64{point_inv_bytes b}) : proj_point = let px = BSeq.nat_from_bytes_be (sub b 0 32) in let py = BSeq.nat_from_bytes_be (sub b 32 32) in to_proj_point (px, py)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.NatMod.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt8.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.K256.PointOps.fst" }
[ { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "BSeq" }, { "abbrev": true, "full_module": "Lib.NatMod", "short_module": "M" }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p: Spec.K256.PointOps.aff_point -> Lib.ByteSequence.lbytes 64
Prims.Tot
[ "total" ]
[]
[ "Spec.K256.PointOps.aff_point", "Spec.K256.PointOps.felem", "Lib.Sequence.concat", "Lib.IntTypes.uint8", "Lib.Sequence.seq", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Prims.l_and", "Prims.eq2", "Prims.nat", "Lib.Sequence.length", "Prims.l_or", "Prims.b2t", "Prims.op_LessThan", "Prims.pow2", "Prims.op_Multiply", "Lib.ByteSequence.nat_from_intseq_be", "Lib.ByteSequence.nat_to_bytes_be", "Lib.ByteSequence.lbytes" ]
[]
false
false
false
false
false
let aff_point_store (p: aff_point) : BSeq.lbytes 64 =
let px, py = p in let pxb = BSeq.nat_to_bytes_be 32 px in let pxy = BSeq.nat_to_bytes_be 32 py in concat #uint8 #32 #32 pxb pxy
false
Spec.K256.PointOps.fst
Spec.K256.PointOps.load_point
val load_point (b: BSeq.lbytes 64) : option proj_point
val load_point (b: BSeq.lbytes 64) : option proj_point
let load_point (b:BSeq.lbytes 64) : option proj_point = match (aff_point_load b) with | Some p -> Some (to_proj_point p) | None -> None
{ "file_name": "specs/Spec.K256.PointOps.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 16, "end_line": 182, "start_col": 0, "start_line": 179 }
module Spec.K256.PointOps open FStar.Mul open Lib.IntTypes open Lib.Sequence module M = Lib.NatMod module BSeq = Lib.ByteSequence #set-options "--z3rlimit 30 --fuel 0 --ifuel 0" /// Finite field let prime : (p:pos{p = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F}) = assert_norm (24 < pow2 256 - 0x1000003D1); assert_norm (pow2 256 - 0x1000003D1 = pow2 256 - pow2 32 - pow2 9 - pow2 8 - pow2 7 - pow2 6 - pow2 4 - 1); assert_norm (pow2 256 - 0x1000003D1 = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F); pow2 256 - 0x1000003D1 let felem = x:nat{x < prime} let zero : felem = 0 let one : felem = 1 let fadd (x y:felem) : felem = (x + y) % prime let fsub (x y:felem) : felem = (x - y) % prime let fmul (x y:felem) : felem = (x * y) % prime let finv (x:felem) : felem = M.pow_mod #prime x (prime - 2) let fsqrt (x:felem) : felem = M.pow_mod #prime x ((prime + 1) / 4) let is_fodd (x:nat) : bool = x % 2 = 1 let ( +% ) = fadd let ( -% ) = fsub let ( *% ) = fmul let ( /% ) (x y:felem) = x *% finv y /// Scalar field // Group order let q : q:pos{q < pow2 256} = assert_norm (0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141 < pow2 256); 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141 let qelem = x:nat{x < q} let qadd (x y:qelem) : qelem = (x + y) % q let qmul (x y:qelem) : qelem = (x * y) % q let qinv (x:qelem) : qelem = M.pow_mod #q x (q - 2) let qnegate (x:qelem) : qelem = (- x) % q let scalar_is_high (x:qelem) : bool = x > q / 2 let ( +^ ) = qadd let ( *^ ) = qmul /// Elliptic curve let aff_point = felem & felem // Affine point let proj_point = felem & felem & felem // Projective coordinates // y * y = x * x * x + b let b : felem = 7 let is_on_curve (p:aff_point) = let x, y = p in y *% y = x *% x *% x +% b let aff_point_at_inf : aff_point = (zero, zero) // not on the curve! let point_at_inf : proj_point = (zero, one, zero) let is_aff_point_at_inf (p:aff_point) : bool = let (x, y) = p in x = zero && y = zero let is_proj_point_at_inf (p:proj_point) : bool = let (_, _, z) = p in z = zero let to_aff_point (p:proj_point) : aff_point = // if is_proj_point_at_inf p then aff_point_at_inf let (px, py, pz) = p in let zinv = finv pz in let x = px *% zinv in let y = py *% zinv in (x, y) let to_proj_point (p:aff_point) : proj_point = let (x, y) = p in (x, y, one) // Base point let g_x : felem = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 let g_y : felem = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 let g : proj_point = (g_x, g_y, one) /// Point addition in affine coordinates let aff_point_double (p:aff_point) : aff_point = let (px, py) = p in if is_aff_point_at_inf p then p else begin if py = 0 then aff_point_at_inf else begin let lambda = 3 *% px *% px /% (2 *% py) in let rx = lambda *% lambda -% px -% px in let ry = lambda *% (px -% rx) -% py in (rx, ry) end end let aff_point_add (p:aff_point) (q:aff_point) : aff_point = let (px, py) = p in let (qx, qy) = q in if is_aff_point_at_inf p then q else begin if is_aff_point_at_inf q then p else begin if p = q then aff_point_double p else begin if qx = px then aff_point_at_inf else begin let lambda = (qy -% py) /% (qx -% px) in let rx = lambda *% lambda -% px -% qx in let ry = lambda *% (px -% rx) -% py in (rx, ry) end end end end let aff_point_negate (p:aff_point) : aff_point = let x, y = p in x, (-y) % prime /// Point addition and doubling in projective coordinates let point_add (p:proj_point) (q:proj_point) : proj_point = let x1, y1, z1 = p in let x2, y2, z2 = q in let xx = x1 *% x2 in let yy = y1 *% y2 in let zz = z1 *% z2 in let xy_pairs = (x1 +% y1) *% (x2 +% y2) -% (xx +% yy) in let yz_pairs = (y1 +% z1) *% (y2 +% z2) -% (yy +% zz) in let xz_pairs = (x1 +% z1) *% (x2 +% z2) -% (xx +% zz) in let bzz3 = 3 *% b *% zz in let yy_m_bzz3 = yy -% bzz3 in let yy_p_bzz3 = yy +% bzz3 in let byz3 = 3 *% b *% yz_pairs in let xx3 = 3 *% xx in let bxx9 = 3 *% b *% xx3 in let x3 = xy_pairs *% yy_m_bzz3 -% byz3 *% xz_pairs in let y3 = yy_p_bzz3 *% yy_m_bzz3 +% bxx9 *% xz_pairs in let z3 = yz_pairs *% yy_p_bzz3 +% xx3 *% xy_pairs in x3, y3, z3 let point_double (p:proj_point) : proj_point = let x, y, z = p in let yy = y *% y in let zz = z *% z in let xy2 = 2 *% x *% y in let bzz3 = 3 *% b *% zz in let bzz9 = 3 *% bzz3 in let yy_m_bzz9 = yy -% bzz9 in let yy_p_bzz3 = yy +% bzz3 in let yy_zz = yy *% zz in let t = 24 *% b *% yy_zz in let x3 = xy2 *% yy_m_bzz9 in let y3 = yy_m_bzz9 *% yy_p_bzz3 +% t in let z3 = yy *% y *% z *% 8 in x3, y3, z3 let point_negate (p:proj_point) : proj_point = let x, y, z = p in x, (-y) % prime, z /// Point conversion between affine, projective and bytes representation let aff_point_load (b:BSeq.lbytes 64) : option aff_point = let pk_x = BSeq.nat_from_bytes_be (sub b 0 32) in let pk_y = BSeq.nat_from_bytes_be (sub b 32 32) in let is_x_valid = pk_x < prime in let is_y_valid = pk_y < prime in let is_xy_on_curve = if is_x_valid && is_y_valid then is_on_curve (pk_x, pk_y) else false in if is_xy_on_curve then Some (pk_x, pk_y) else None
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.NatMod.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt8.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.K256.PointOps.fst" }
[ { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "BSeq" }, { "abbrev": true, "full_module": "Lib.NatMod", "short_module": "M" }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
b: Lib.ByteSequence.lbytes 64 -> FStar.Pervasives.Native.option Spec.K256.PointOps.proj_point
Prims.Tot
[ "total" ]
[]
[ "Lib.ByteSequence.lbytes", "Spec.K256.PointOps.aff_point_load", "Spec.K256.PointOps.aff_point", "FStar.Pervasives.Native.Some", "Spec.K256.PointOps.proj_point", "Spec.K256.PointOps.to_proj_point", "FStar.Pervasives.Native.None", "FStar.Pervasives.Native.option" ]
[]
false
false
false
false
false
let load_point (b: BSeq.lbytes 64) : option proj_point =
match (aff_point_load b) with | Some p -> Some (to_proj_point p) | None -> None
false
Spec.K256.PointOps.fst
Spec.K256.PointOps.point_add
val point_add (p q: proj_point) : proj_point
val point_add (p q: proj_point) : proj_point
let point_add (p:proj_point) (q:proj_point) : proj_point = let x1, y1, z1 = p in let x2, y2, z2 = q in let xx = x1 *% x2 in let yy = y1 *% y2 in let zz = z1 *% z2 in let xy_pairs = (x1 +% y1) *% (x2 +% y2) -% (xx +% yy) in let yz_pairs = (y1 +% z1) *% (y2 +% z2) -% (yy +% zz) in let xz_pairs = (x1 +% z1) *% (x2 +% z2) -% (xx +% zz) in let bzz3 = 3 *% b *% zz in let yy_m_bzz3 = yy -% bzz3 in let yy_p_bzz3 = yy +% bzz3 in let byz3 = 3 *% b *% yz_pairs in let xx3 = 3 *% xx in let bxx9 = 3 *% b *% xx3 in let x3 = xy_pairs *% yy_m_bzz3 -% byz3 *% xz_pairs in let y3 = yy_p_bzz3 *% yy_m_bzz3 +% bxx9 *% xz_pairs in let z3 = yz_pairs *% yy_p_bzz3 +% xx3 *% xy_pairs in x3, y3, z3
{ "file_name": "specs/Spec.K256.PointOps.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 12, "end_line": 146, "start_col": 0, "start_line": 128 }
module Spec.K256.PointOps open FStar.Mul open Lib.IntTypes open Lib.Sequence module M = Lib.NatMod module BSeq = Lib.ByteSequence #set-options "--z3rlimit 30 --fuel 0 --ifuel 0" /// Finite field let prime : (p:pos{p = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F}) = assert_norm (24 < pow2 256 - 0x1000003D1); assert_norm (pow2 256 - 0x1000003D1 = pow2 256 - pow2 32 - pow2 9 - pow2 8 - pow2 7 - pow2 6 - pow2 4 - 1); assert_norm (pow2 256 - 0x1000003D1 = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F); pow2 256 - 0x1000003D1 let felem = x:nat{x < prime} let zero : felem = 0 let one : felem = 1 let fadd (x y:felem) : felem = (x + y) % prime let fsub (x y:felem) : felem = (x - y) % prime let fmul (x y:felem) : felem = (x * y) % prime let finv (x:felem) : felem = M.pow_mod #prime x (prime - 2) let fsqrt (x:felem) : felem = M.pow_mod #prime x ((prime + 1) / 4) let is_fodd (x:nat) : bool = x % 2 = 1 let ( +% ) = fadd let ( -% ) = fsub let ( *% ) = fmul let ( /% ) (x y:felem) = x *% finv y /// Scalar field // Group order let q : q:pos{q < pow2 256} = assert_norm (0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141 < pow2 256); 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141 let qelem = x:nat{x < q} let qadd (x y:qelem) : qelem = (x + y) % q let qmul (x y:qelem) : qelem = (x * y) % q let qinv (x:qelem) : qelem = M.pow_mod #q x (q - 2) let qnegate (x:qelem) : qelem = (- x) % q let scalar_is_high (x:qelem) : bool = x > q / 2 let ( +^ ) = qadd let ( *^ ) = qmul /// Elliptic curve let aff_point = felem & felem // Affine point let proj_point = felem & felem & felem // Projective coordinates // y * y = x * x * x + b let b : felem = 7 let is_on_curve (p:aff_point) = let x, y = p in y *% y = x *% x *% x +% b let aff_point_at_inf : aff_point = (zero, zero) // not on the curve! let point_at_inf : proj_point = (zero, one, zero) let is_aff_point_at_inf (p:aff_point) : bool = let (x, y) = p in x = zero && y = zero let is_proj_point_at_inf (p:proj_point) : bool = let (_, _, z) = p in z = zero let to_aff_point (p:proj_point) : aff_point = // if is_proj_point_at_inf p then aff_point_at_inf let (px, py, pz) = p in let zinv = finv pz in let x = px *% zinv in let y = py *% zinv in (x, y) let to_proj_point (p:aff_point) : proj_point = let (x, y) = p in (x, y, one) // Base point let g_x : felem = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 let g_y : felem = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 let g : proj_point = (g_x, g_y, one) /// Point addition in affine coordinates let aff_point_double (p:aff_point) : aff_point = let (px, py) = p in if is_aff_point_at_inf p then p else begin if py = 0 then aff_point_at_inf else begin let lambda = 3 *% px *% px /% (2 *% py) in let rx = lambda *% lambda -% px -% px in let ry = lambda *% (px -% rx) -% py in (rx, ry) end end let aff_point_add (p:aff_point) (q:aff_point) : aff_point = let (px, py) = p in let (qx, qy) = q in if is_aff_point_at_inf p then q else begin if is_aff_point_at_inf q then p else begin if p = q then aff_point_double p else begin if qx = px then aff_point_at_inf else begin let lambda = (qy -% py) /% (qx -% px) in let rx = lambda *% lambda -% px -% qx in let ry = lambda *% (px -% rx) -% py in (rx, ry) end end end end let aff_point_negate (p:aff_point) : aff_point = let x, y = p in x, (-y) % prime /// Point addition and doubling in projective coordinates
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.NatMod.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt8.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.K256.PointOps.fst" }
[ { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "BSeq" }, { "abbrev": true, "full_module": "Lib.NatMod", "short_module": "M" }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p: Spec.K256.PointOps.proj_point -> q: Spec.K256.PointOps.proj_point -> Spec.K256.PointOps.proj_point
Prims.Tot
[ "total" ]
[]
[ "Spec.K256.PointOps.proj_point", "Spec.K256.PointOps.felem", "FStar.Pervasives.Native.Mktuple3", "Spec.K256.PointOps.op_Plus_Percent", "Spec.K256.PointOps.op_Star_Percent", "Spec.K256.PointOps.op_Subtraction_Percent", "Spec.K256.PointOps.b" ]
[]
false
false
false
true
false
let point_add (p q: proj_point) : proj_point =
let x1, y1, z1 = p in let x2, y2, z2 = q in let xx = x1 *% x2 in let yy = y1 *% y2 in let zz = z1 *% z2 in let xy_pairs = (x1 +% y1) *% (x2 +% y2) -% (xx +% yy) in let yz_pairs = (y1 +% z1) *% (y2 +% z2) -% (yy +% zz) in let xz_pairs = (x1 +% z1) *% (x2 +% z2) -% (xx +% zz) in let bzz3 = 3 *% b *% zz in let yy_m_bzz3 = yy -% bzz3 in let yy_p_bzz3 = yy +% bzz3 in let byz3 = 3 *% b *% yz_pairs in let xx3 = 3 *% xx in let bxx9 = 3 *% b *% xx3 in let x3 = xy_pairs *% yy_m_bzz3 -% byz3 *% xz_pairs in let y3 = yy_p_bzz3 *% yy_m_bzz3 +% bxx9 *% xz_pairs in let z3 = yz_pairs *% yy_p_bzz3 +% xx3 *% xy_pairs in x3, y3, z3
false
Hacl.Spec.PrecompBaseTable256.fst
Hacl.Spec.PrecompBaseTable256.lemma_decompose_nat256_as_four_u64
val lemma_decompose_nat256_as_four_u64: x:nat{x < pow2 256} -> Lemma (let (x0, x1, x2, x3) = decompose_nat256_as_four_u64 x in x0 + x1 * pow2 64 + x2 * pow2 128 + x3 * pow2 192 == x)
val lemma_decompose_nat256_as_four_u64: x:nat{x < pow2 256} -> Lemma (let (x0, x1, x2, x3) = decompose_nat256_as_four_u64 x in x0 + x1 * pow2 64 + x2 * pow2 128 + x3 * pow2 192 == x)
let lemma_decompose_nat256_as_four_u64 x = let x0 = x % pow2 64 in let x1 = x / pow2 64 % pow2 64 in let x2 = x / pow2 128 % pow2 64 in let x3' = x / pow2 192 % pow2 64 in Math.Lemmas.lemma_div_lt x 256 192; Math.Lemmas.small_mod (x / pow2 192) (pow2 64); let x3 = x / pow2 192 in assert (x3 == x3'); calc (==) { x0 + x1 * pow2 64 + x2 * pow2 128 + x3 * pow2 192; (==) { } x0 + x1 * pow2 64 + (x / pow2 128 % pow2 64) * pow2 128 + x / pow2 192 * pow2 192; (==) { lemma_mod_pow2_sub x 128 64 } x0 + x1 * pow2 64 + x % pow2 192 - x % pow2 128 + x / pow2 192 * pow2 192; (==) { Math.Lemmas.euclidean_division_definition x (pow2 192) } x0 + x1 * pow2 64 - x % pow2 128 + x; (==) { lemma_mod_pow2_sub x 64 64 } x; }
{ "file_name": "code/bignum/Hacl.Spec.PrecompBaseTable256.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 3, "end_line": 45, "start_col": 0, "start_line": 26 }
module Hacl.Spec.PrecompBaseTable256 open FStar.Mul open Lib.IntTypes module LSeq = Lib.Sequence module Loops = Lib.LoopCombinators module LE = Lib.Exponentiation module SE = Spec.Exponentiation module BD = Hacl.Spec.Bignum.Definitions #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" let lemma_mod_pow2_sub x a b = calc (==) { x / pow2 a % pow2 b * pow2 a; (==) { Math.Lemmas.pow2_modulo_division_lemma_1 x a (a + b) } x % pow2 (a + b) / pow2 a * pow2 a; (==) { Math.Lemmas.euclidean_division_definition (x % pow2 (a + b)) (pow2 a) } x % pow2 (a + b) - x % pow2 (a + b) % pow2 a; (==) { Math.Lemmas.pow2_modulo_modulo_lemma_1 x a (a + b) } x % pow2 (a + b) - x % pow2 a; }
{ "checked_file": "/", "dependencies": [ "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Hacl.Spec.Bignum.Definitions.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": true, "source_file": "Hacl.Spec.PrecompBaseTable256.fst" }
[ { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Definitions", "short_module": "BD" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec", "short_module": null }, { "abbrev": false, "full_module": "Hacl.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": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: Prims.nat{x < Prims.pow2 256} -> FStar.Pervasives.Lemma (ensures (let _ = Hacl.Spec.PrecompBaseTable256.decompose_nat256_as_four_u64 x in (let FStar.Pervasives.Native.Mktuple4 #_ #_ #_ #_ x0 x1 x2 x3 = _ in x0 + x1 * Prims.pow2 64 + x2 * Prims.pow2 128 + x3 * Prims.pow2 192 == x) <: Type0))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.nat", "Prims.b2t", "Prims.op_LessThan", "Prims.pow2", "FStar.Calc.calc_finish", "Prims.int", "Prims.eq2", "Prims.op_Addition", "FStar.Mul.op_Star", "Prims.Cons", "FStar.Preorder.relation", "Prims.Nil", "Prims.unit", "FStar.Calc.calc_step", "Prims.op_Subtraction", "Prims.op_Modulus", "Prims.op_Division", "FStar.Calc.calc_init", "FStar.Calc.calc_pack", "Prims.squash", "Hacl.Spec.PrecompBaseTable256.lemma_mod_pow2_sub", "FStar.Math.Lemmas.euclidean_division_definition", "Prims._assert", "FStar.Math.Lemmas.small_mod", "FStar.Math.Lemmas.lemma_div_lt" ]
[]
false
false
true
false
false
let lemma_decompose_nat256_as_four_u64 x =
let x0 = x % pow2 64 in let x1 = x / pow2 64 % pow2 64 in let x2 = x / pow2 128 % pow2 64 in let x3' = x / pow2 192 % pow2 64 in Math.Lemmas.lemma_div_lt x 256 192; Math.Lemmas.small_mod (x / pow2 192) (pow2 64); let x3 = x / pow2 192 in assert (x3 == x3'); calc ( == ) { x0 + x1 * pow2 64 + x2 * pow2 128 + x3 * pow2 192; ( == ) { () } x0 + x1 * pow2 64 + (x / pow2 128 % pow2 64) * pow2 128 + (x / pow2 192) * pow2 192; ( == ) { lemma_mod_pow2_sub x 128 64 } x0 + x1 * pow2 64 + x % pow2 192 - x % pow2 128 + (x / pow2 192) * pow2 192; ( == ) { Math.Lemmas.euclidean_division_definition x (pow2 192) } x0 + x1 * pow2 64 - x % pow2 128 + x; ( == ) { lemma_mod_pow2_sub x 64 64 } x; }
false
Spec.K256.PointOps.fst
Spec.K256.PointOps.point_double
val point_double (p: proj_point) : proj_point
val point_double (p: proj_point) : proj_point
let point_double (p:proj_point) : proj_point = let x, y, z = p in let yy = y *% y in let zz = z *% z in let xy2 = 2 *% x *% y in let bzz3 = 3 *% b *% zz in let bzz9 = 3 *% bzz3 in let yy_m_bzz9 = yy -% bzz9 in let yy_p_bzz3 = yy +% bzz3 in let yy_zz = yy *% zz in let t = 24 *% b *% yy_zz in let x3 = xy2 *% yy_m_bzz9 in let y3 = yy_m_bzz9 *% yy_p_bzz3 +% t in let z3 = yy *% y *% z *% 8 in x3, y3, z3
{ "file_name": "specs/Spec.K256.PointOps.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 12, "end_line": 162, "start_col": 0, "start_line": 148 }
module Spec.K256.PointOps open FStar.Mul open Lib.IntTypes open Lib.Sequence module M = Lib.NatMod module BSeq = Lib.ByteSequence #set-options "--z3rlimit 30 --fuel 0 --ifuel 0" /// Finite field let prime : (p:pos{p = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F}) = assert_norm (24 < pow2 256 - 0x1000003D1); assert_norm (pow2 256 - 0x1000003D1 = pow2 256 - pow2 32 - pow2 9 - pow2 8 - pow2 7 - pow2 6 - pow2 4 - 1); assert_norm (pow2 256 - 0x1000003D1 = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F); pow2 256 - 0x1000003D1 let felem = x:nat{x < prime} let zero : felem = 0 let one : felem = 1 let fadd (x y:felem) : felem = (x + y) % prime let fsub (x y:felem) : felem = (x - y) % prime let fmul (x y:felem) : felem = (x * y) % prime let finv (x:felem) : felem = M.pow_mod #prime x (prime - 2) let fsqrt (x:felem) : felem = M.pow_mod #prime x ((prime + 1) / 4) let is_fodd (x:nat) : bool = x % 2 = 1 let ( +% ) = fadd let ( -% ) = fsub let ( *% ) = fmul let ( /% ) (x y:felem) = x *% finv y /// Scalar field // Group order let q : q:pos{q < pow2 256} = assert_norm (0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141 < pow2 256); 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141 let qelem = x:nat{x < q} let qadd (x y:qelem) : qelem = (x + y) % q let qmul (x y:qelem) : qelem = (x * y) % q let qinv (x:qelem) : qelem = M.pow_mod #q x (q - 2) let qnegate (x:qelem) : qelem = (- x) % q let scalar_is_high (x:qelem) : bool = x > q / 2 let ( +^ ) = qadd let ( *^ ) = qmul /// Elliptic curve let aff_point = felem & felem // Affine point let proj_point = felem & felem & felem // Projective coordinates // y * y = x * x * x + b let b : felem = 7 let is_on_curve (p:aff_point) = let x, y = p in y *% y = x *% x *% x +% b let aff_point_at_inf : aff_point = (zero, zero) // not on the curve! let point_at_inf : proj_point = (zero, one, zero) let is_aff_point_at_inf (p:aff_point) : bool = let (x, y) = p in x = zero && y = zero let is_proj_point_at_inf (p:proj_point) : bool = let (_, _, z) = p in z = zero let to_aff_point (p:proj_point) : aff_point = // if is_proj_point_at_inf p then aff_point_at_inf let (px, py, pz) = p in let zinv = finv pz in let x = px *% zinv in let y = py *% zinv in (x, y) let to_proj_point (p:aff_point) : proj_point = let (x, y) = p in (x, y, one) // Base point let g_x : felem = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 let g_y : felem = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 let g : proj_point = (g_x, g_y, one) /// Point addition in affine coordinates let aff_point_double (p:aff_point) : aff_point = let (px, py) = p in if is_aff_point_at_inf p then p else begin if py = 0 then aff_point_at_inf else begin let lambda = 3 *% px *% px /% (2 *% py) in let rx = lambda *% lambda -% px -% px in let ry = lambda *% (px -% rx) -% py in (rx, ry) end end let aff_point_add (p:aff_point) (q:aff_point) : aff_point = let (px, py) = p in let (qx, qy) = q in if is_aff_point_at_inf p then q else begin if is_aff_point_at_inf q then p else begin if p = q then aff_point_double p else begin if qx = px then aff_point_at_inf else begin let lambda = (qy -% py) /% (qx -% px) in let rx = lambda *% lambda -% px -% qx in let ry = lambda *% (px -% rx) -% py in (rx, ry) end end end end let aff_point_negate (p:aff_point) : aff_point = let x, y = p in x, (-y) % prime /// Point addition and doubling in projective coordinates let point_add (p:proj_point) (q:proj_point) : proj_point = let x1, y1, z1 = p in let x2, y2, z2 = q in let xx = x1 *% x2 in let yy = y1 *% y2 in let zz = z1 *% z2 in let xy_pairs = (x1 +% y1) *% (x2 +% y2) -% (xx +% yy) in let yz_pairs = (y1 +% z1) *% (y2 +% z2) -% (yy +% zz) in let xz_pairs = (x1 +% z1) *% (x2 +% z2) -% (xx +% zz) in let bzz3 = 3 *% b *% zz in let yy_m_bzz3 = yy -% bzz3 in let yy_p_bzz3 = yy +% bzz3 in let byz3 = 3 *% b *% yz_pairs in let xx3 = 3 *% xx in let bxx9 = 3 *% b *% xx3 in let x3 = xy_pairs *% yy_m_bzz3 -% byz3 *% xz_pairs in let y3 = yy_p_bzz3 *% yy_m_bzz3 +% bxx9 *% xz_pairs in let z3 = yz_pairs *% yy_p_bzz3 +% xx3 *% xy_pairs in x3, y3, z3
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.NatMod.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt8.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.K256.PointOps.fst" }
[ { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "BSeq" }, { "abbrev": true, "full_module": "Lib.NatMod", "short_module": "M" }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p: Spec.K256.PointOps.proj_point -> Spec.K256.PointOps.proj_point
Prims.Tot
[ "total" ]
[]
[ "Spec.K256.PointOps.proj_point", "Spec.K256.PointOps.felem", "FStar.Pervasives.Native.Mktuple3", "Spec.K256.PointOps.op_Star_Percent", "Spec.K256.PointOps.op_Plus_Percent", "Spec.K256.PointOps.b", "Spec.K256.PointOps.op_Subtraction_Percent" ]
[]
false
false
false
true
false
let point_double (p: proj_point) : proj_point =
let x, y, z = p in let yy = y *% y in let zz = z *% z in let xy2 = 2 *% x *% y in let bzz3 = 3 *% b *% zz in let bzz9 = 3 *% bzz3 in let yy_m_bzz9 = yy -% bzz9 in let yy_p_bzz3 = yy +% bzz3 in let yy_zz = yy *% zz in let t = 24 *% b *% yy_zz in let x3 = xy2 *% yy_m_bzz9 in let y3 = yy_m_bzz9 *% yy_p_bzz3 +% t in let z3 = yy *% y *% z *% 8 in x3, y3, z3
false
Spec.K256.PointOps.fst
Spec.K256.PointOps.point_store
val point_store (p: proj_point) : BSeq.lbytes 64
val point_store (p: proj_point) : BSeq.lbytes 64
let point_store (p:proj_point) : BSeq.lbytes 64 = aff_point_store (to_aff_point p)
{ "file_name": "specs/Spec.K256.PointOps.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 34, "end_line": 203, "start_col": 0, "start_line": 202 }
module Spec.K256.PointOps open FStar.Mul open Lib.IntTypes open Lib.Sequence module M = Lib.NatMod module BSeq = Lib.ByteSequence #set-options "--z3rlimit 30 --fuel 0 --ifuel 0" /// Finite field let prime : (p:pos{p = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F}) = assert_norm (24 < pow2 256 - 0x1000003D1); assert_norm (pow2 256 - 0x1000003D1 = pow2 256 - pow2 32 - pow2 9 - pow2 8 - pow2 7 - pow2 6 - pow2 4 - 1); assert_norm (pow2 256 - 0x1000003D1 = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F); pow2 256 - 0x1000003D1 let felem = x:nat{x < prime} let zero : felem = 0 let one : felem = 1 let fadd (x y:felem) : felem = (x + y) % prime let fsub (x y:felem) : felem = (x - y) % prime let fmul (x y:felem) : felem = (x * y) % prime let finv (x:felem) : felem = M.pow_mod #prime x (prime - 2) let fsqrt (x:felem) : felem = M.pow_mod #prime x ((prime + 1) / 4) let is_fodd (x:nat) : bool = x % 2 = 1 let ( +% ) = fadd let ( -% ) = fsub let ( *% ) = fmul let ( /% ) (x y:felem) = x *% finv y /// Scalar field // Group order let q : q:pos{q < pow2 256} = assert_norm (0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141 < pow2 256); 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141 let qelem = x:nat{x < q} let qadd (x y:qelem) : qelem = (x + y) % q let qmul (x y:qelem) : qelem = (x * y) % q let qinv (x:qelem) : qelem = M.pow_mod #q x (q - 2) let qnegate (x:qelem) : qelem = (- x) % q let scalar_is_high (x:qelem) : bool = x > q / 2 let ( +^ ) = qadd let ( *^ ) = qmul /// Elliptic curve let aff_point = felem & felem // Affine point let proj_point = felem & felem & felem // Projective coordinates // y * y = x * x * x + b let b : felem = 7 let is_on_curve (p:aff_point) = let x, y = p in y *% y = x *% x *% x +% b let aff_point_at_inf : aff_point = (zero, zero) // not on the curve! let point_at_inf : proj_point = (zero, one, zero) let is_aff_point_at_inf (p:aff_point) : bool = let (x, y) = p in x = zero && y = zero let is_proj_point_at_inf (p:proj_point) : bool = let (_, _, z) = p in z = zero let to_aff_point (p:proj_point) : aff_point = // if is_proj_point_at_inf p then aff_point_at_inf let (px, py, pz) = p in let zinv = finv pz in let x = px *% zinv in let y = py *% zinv in (x, y) let to_proj_point (p:aff_point) : proj_point = let (x, y) = p in (x, y, one) // Base point let g_x : felem = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 let g_y : felem = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 let g : proj_point = (g_x, g_y, one) /// Point addition in affine coordinates let aff_point_double (p:aff_point) : aff_point = let (px, py) = p in if is_aff_point_at_inf p then p else begin if py = 0 then aff_point_at_inf else begin let lambda = 3 *% px *% px /% (2 *% py) in let rx = lambda *% lambda -% px -% px in let ry = lambda *% (px -% rx) -% py in (rx, ry) end end let aff_point_add (p:aff_point) (q:aff_point) : aff_point = let (px, py) = p in let (qx, qy) = q in if is_aff_point_at_inf p then q else begin if is_aff_point_at_inf q then p else begin if p = q then aff_point_double p else begin if qx = px then aff_point_at_inf else begin let lambda = (qy -% py) /% (qx -% px) in let rx = lambda *% lambda -% px -% qx in let ry = lambda *% (px -% rx) -% py in (rx, ry) end end end end let aff_point_negate (p:aff_point) : aff_point = let x, y = p in x, (-y) % prime /// Point addition and doubling in projective coordinates let point_add (p:proj_point) (q:proj_point) : proj_point = let x1, y1, z1 = p in let x2, y2, z2 = q in let xx = x1 *% x2 in let yy = y1 *% y2 in let zz = z1 *% z2 in let xy_pairs = (x1 +% y1) *% (x2 +% y2) -% (xx +% yy) in let yz_pairs = (y1 +% z1) *% (y2 +% z2) -% (yy +% zz) in let xz_pairs = (x1 +% z1) *% (x2 +% z2) -% (xx +% zz) in let bzz3 = 3 *% b *% zz in let yy_m_bzz3 = yy -% bzz3 in let yy_p_bzz3 = yy +% bzz3 in let byz3 = 3 *% b *% yz_pairs in let xx3 = 3 *% xx in let bxx9 = 3 *% b *% xx3 in let x3 = xy_pairs *% yy_m_bzz3 -% byz3 *% xz_pairs in let y3 = yy_p_bzz3 *% yy_m_bzz3 +% bxx9 *% xz_pairs in let z3 = yz_pairs *% yy_p_bzz3 +% xx3 *% xy_pairs in x3, y3, z3 let point_double (p:proj_point) : proj_point = let x, y, z = p in let yy = y *% y in let zz = z *% z in let xy2 = 2 *% x *% y in let bzz3 = 3 *% b *% zz in let bzz9 = 3 *% bzz3 in let yy_m_bzz9 = yy -% bzz9 in let yy_p_bzz3 = yy +% bzz3 in let yy_zz = yy *% zz in let t = 24 *% b *% yy_zz in let x3 = xy2 *% yy_m_bzz9 in let y3 = yy_m_bzz9 *% yy_p_bzz3 +% t in let z3 = yy *% y *% z *% 8 in x3, y3, z3 let point_negate (p:proj_point) : proj_point = let x, y, z = p in x, (-y) % prime, z /// Point conversion between affine, projective and bytes representation let aff_point_load (b:BSeq.lbytes 64) : option aff_point = let pk_x = BSeq.nat_from_bytes_be (sub b 0 32) in let pk_y = BSeq.nat_from_bytes_be (sub b 32 32) in let is_x_valid = pk_x < prime in let is_y_valid = pk_y < prime in let is_xy_on_curve = if is_x_valid && is_y_valid then is_on_curve (pk_x, pk_y) else false in if is_xy_on_curve then Some (pk_x, pk_y) else None let load_point (b:BSeq.lbytes 64) : option proj_point = match (aff_point_load b) with | Some p -> Some (to_proj_point p) | None -> None let point_inv_bytes (b:BSeq.lbytes 64) = let px = BSeq.nat_from_bytes_be (sub b 0 32) in let py = BSeq.nat_from_bytes_be (sub b 32 32) in px < prime && py < prime && is_on_curve (px, py) let load_point_nocheck (b:BSeq.lbytes 64{point_inv_bytes b}) : proj_point = let px = BSeq.nat_from_bytes_be (sub b 0 32) in let py = BSeq.nat_from_bytes_be (sub b 32 32) in to_proj_point (px, py) let aff_point_store (p:aff_point) : BSeq.lbytes 64 = let (px, py) = p in let pxb = BSeq.nat_to_bytes_be 32 px in let pxy = BSeq.nat_to_bytes_be 32 py in concat #uint8 #32 #32 pxb pxy
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.NatMod.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt8.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.K256.PointOps.fst" }
[ { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "BSeq" }, { "abbrev": true, "full_module": "Lib.NatMod", "short_module": "M" }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
p: Spec.K256.PointOps.proj_point -> Lib.ByteSequence.lbytes 64
Prims.Tot
[ "total" ]
[]
[ "Spec.K256.PointOps.proj_point", "Spec.K256.PointOps.aff_point_store", "Spec.K256.PointOps.to_aff_point", "Lib.ByteSequence.lbytes" ]
[]
false
false
false
false
false
let point_store (p: proj_point) : BSeq.lbytes 64 =
aff_point_store (to_aff_point p)
false
Spec.K256.PointOps.fst
Spec.K256.PointOps.load_point_nocheck
val load_point_nocheck (b: BSeq.lbytes 64 {point_inv_bytes b}) : proj_point
val load_point_nocheck (b: BSeq.lbytes 64 {point_inv_bytes b}) : proj_point
let load_point_nocheck (b:BSeq.lbytes 64{point_inv_bytes b}) : proj_point = let px = BSeq.nat_from_bytes_be (sub b 0 32) in let py = BSeq.nat_from_bytes_be (sub b 32 32) in to_proj_point (px, py)
{ "file_name": "specs/Spec.K256.PointOps.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 24, "end_line": 193, "start_col": 0, "start_line": 190 }
module Spec.K256.PointOps open FStar.Mul open Lib.IntTypes open Lib.Sequence module M = Lib.NatMod module BSeq = Lib.ByteSequence #set-options "--z3rlimit 30 --fuel 0 --ifuel 0" /// Finite field let prime : (p:pos{p = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F}) = assert_norm (24 < pow2 256 - 0x1000003D1); assert_norm (pow2 256 - 0x1000003D1 = pow2 256 - pow2 32 - pow2 9 - pow2 8 - pow2 7 - pow2 6 - pow2 4 - 1); assert_norm (pow2 256 - 0x1000003D1 = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F); pow2 256 - 0x1000003D1 let felem = x:nat{x < prime} let zero : felem = 0 let one : felem = 1 let fadd (x y:felem) : felem = (x + y) % prime let fsub (x y:felem) : felem = (x - y) % prime let fmul (x y:felem) : felem = (x * y) % prime let finv (x:felem) : felem = M.pow_mod #prime x (prime - 2) let fsqrt (x:felem) : felem = M.pow_mod #prime x ((prime + 1) / 4) let is_fodd (x:nat) : bool = x % 2 = 1 let ( +% ) = fadd let ( -% ) = fsub let ( *% ) = fmul let ( /% ) (x y:felem) = x *% finv y /// Scalar field // Group order let q : q:pos{q < pow2 256} = assert_norm (0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141 < pow2 256); 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141 let qelem = x:nat{x < q} let qadd (x y:qelem) : qelem = (x + y) % q let qmul (x y:qelem) : qelem = (x * y) % q let qinv (x:qelem) : qelem = M.pow_mod #q x (q - 2) let qnegate (x:qelem) : qelem = (- x) % q let scalar_is_high (x:qelem) : bool = x > q / 2 let ( +^ ) = qadd let ( *^ ) = qmul /// Elliptic curve let aff_point = felem & felem // Affine point let proj_point = felem & felem & felem // Projective coordinates // y * y = x * x * x + b let b : felem = 7 let is_on_curve (p:aff_point) = let x, y = p in y *% y = x *% x *% x +% b let aff_point_at_inf : aff_point = (zero, zero) // not on the curve! let point_at_inf : proj_point = (zero, one, zero) let is_aff_point_at_inf (p:aff_point) : bool = let (x, y) = p in x = zero && y = zero let is_proj_point_at_inf (p:proj_point) : bool = let (_, _, z) = p in z = zero let to_aff_point (p:proj_point) : aff_point = // if is_proj_point_at_inf p then aff_point_at_inf let (px, py, pz) = p in let zinv = finv pz in let x = px *% zinv in let y = py *% zinv in (x, y) let to_proj_point (p:aff_point) : proj_point = let (x, y) = p in (x, y, one) // Base point let g_x : felem = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 let g_y : felem = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 let g : proj_point = (g_x, g_y, one) /// Point addition in affine coordinates let aff_point_double (p:aff_point) : aff_point = let (px, py) = p in if is_aff_point_at_inf p then p else begin if py = 0 then aff_point_at_inf else begin let lambda = 3 *% px *% px /% (2 *% py) in let rx = lambda *% lambda -% px -% px in let ry = lambda *% (px -% rx) -% py in (rx, ry) end end let aff_point_add (p:aff_point) (q:aff_point) : aff_point = let (px, py) = p in let (qx, qy) = q in if is_aff_point_at_inf p then q else begin if is_aff_point_at_inf q then p else begin if p = q then aff_point_double p else begin if qx = px then aff_point_at_inf else begin let lambda = (qy -% py) /% (qx -% px) in let rx = lambda *% lambda -% px -% qx in let ry = lambda *% (px -% rx) -% py in (rx, ry) end end end end let aff_point_negate (p:aff_point) : aff_point = let x, y = p in x, (-y) % prime /// Point addition and doubling in projective coordinates let point_add (p:proj_point) (q:proj_point) : proj_point = let x1, y1, z1 = p in let x2, y2, z2 = q in let xx = x1 *% x2 in let yy = y1 *% y2 in let zz = z1 *% z2 in let xy_pairs = (x1 +% y1) *% (x2 +% y2) -% (xx +% yy) in let yz_pairs = (y1 +% z1) *% (y2 +% z2) -% (yy +% zz) in let xz_pairs = (x1 +% z1) *% (x2 +% z2) -% (xx +% zz) in let bzz3 = 3 *% b *% zz in let yy_m_bzz3 = yy -% bzz3 in let yy_p_bzz3 = yy +% bzz3 in let byz3 = 3 *% b *% yz_pairs in let xx3 = 3 *% xx in let bxx9 = 3 *% b *% xx3 in let x3 = xy_pairs *% yy_m_bzz3 -% byz3 *% xz_pairs in let y3 = yy_p_bzz3 *% yy_m_bzz3 +% bxx9 *% xz_pairs in let z3 = yz_pairs *% yy_p_bzz3 +% xx3 *% xy_pairs in x3, y3, z3 let point_double (p:proj_point) : proj_point = let x, y, z = p in let yy = y *% y in let zz = z *% z in let xy2 = 2 *% x *% y in let bzz3 = 3 *% b *% zz in let bzz9 = 3 *% bzz3 in let yy_m_bzz9 = yy -% bzz9 in let yy_p_bzz3 = yy +% bzz3 in let yy_zz = yy *% zz in let t = 24 *% b *% yy_zz in let x3 = xy2 *% yy_m_bzz9 in let y3 = yy_m_bzz9 *% yy_p_bzz3 +% t in let z3 = yy *% y *% z *% 8 in x3, y3, z3 let point_negate (p:proj_point) : proj_point = let x, y, z = p in x, (-y) % prime, z /// Point conversion between affine, projective and bytes representation let aff_point_load (b:BSeq.lbytes 64) : option aff_point = let pk_x = BSeq.nat_from_bytes_be (sub b 0 32) in let pk_y = BSeq.nat_from_bytes_be (sub b 32 32) in let is_x_valid = pk_x < prime in let is_y_valid = pk_y < prime in let is_xy_on_curve = if is_x_valid && is_y_valid then is_on_curve (pk_x, pk_y) else false in if is_xy_on_curve then Some (pk_x, pk_y) else None let load_point (b:BSeq.lbytes 64) : option proj_point = match (aff_point_load b) with | Some p -> Some (to_proj_point p) | None -> None let point_inv_bytes (b:BSeq.lbytes 64) = let px = BSeq.nat_from_bytes_be (sub b 0 32) in let py = BSeq.nat_from_bytes_be (sub b 32 32) in px < prime && py < prime && is_on_curve (px, py)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.NatMod.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt8.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.K256.PointOps.fst" }
[ { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "BSeq" }, { "abbrev": true, "full_module": "Lib.NatMod", "short_module": "M" }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
b: Lib.ByteSequence.lbytes 64 {Spec.K256.PointOps.point_inv_bytes b} -> Spec.K256.PointOps.proj_point
Prims.Tot
[ "total" ]
[]
[ "Lib.ByteSequence.lbytes", "Prims.b2t", "Spec.K256.PointOps.point_inv_bytes", "Spec.K256.PointOps.to_proj_point", "FStar.Pervasives.Native.Mktuple2", "Spec.K256.PointOps.felem", "Prims.nat", "Prims.op_LessThan", "Prims.pow2", "Prims.op_Multiply", "Lib.Sequence.length", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Lib.Sequence.sub", "Lib.ByteSequence.nat_from_bytes_be", "Lib.IntTypes.uint_t", "Spec.K256.PointOps.proj_point" ]
[]
false
false
false
false
false
let load_point_nocheck (b: BSeq.lbytes 64 {point_inv_bytes b}) : proj_point =
let px = BSeq.nat_from_bytes_be (sub b 0 32) in let py = BSeq.nat_from_bytes_be (sub b 32 32) in to_proj_point (px, py)
false
Spec.K256.PointOps.fst
Spec.K256.PointOps.point_inv_bytes
val point_inv_bytes : b: Lib.ByteSequence.lbytes 64 -> Prims.bool
let point_inv_bytes (b:BSeq.lbytes 64) = let px = BSeq.nat_from_bytes_be (sub b 0 32) in let py = BSeq.nat_from_bytes_be (sub b 32 32) in px < prime && py < prime && is_on_curve (px, py)
{ "file_name": "specs/Spec.K256.PointOps.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 50, "end_line": 188, "start_col": 0, "start_line": 185 }
module Spec.K256.PointOps open FStar.Mul open Lib.IntTypes open Lib.Sequence module M = Lib.NatMod module BSeq = Lib.ByteSequence #set-options "--z3rlimit 30 --fuel 0 --ifuel 0" /// Finite field let prime : (p:pos{p = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F}) = assert_norm (24 < pow2 256 - 0x1000003D1); assert_norm (pow2 256 - 0x1000003D1 = pow2 256 - pow2 32 - pow2 9 - pow2 8 - pow2 7 - pow2 6 - pow2 4 - 1); assert_norm (pow2 256 - 0x1000003D1 = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F); pow2 256 - 0x1000003D1 let felem = x:nat{x < prime} let zero : felem = 0 let one : felem = 1 let fadd (x y:felem) : felem = (x + y) % prime let fsub (x y:felem) : felem = (x - y) % prime let fmul (x y:felem) : felem = (x * y) % prime let finv (x:felem) : felem = M.pow_mod #prime x (prime - 2) let fsqrt (x:felem) : felem = M.pow_mod #prime x ((prime + 1) / 4) let is_fodd (x:nat) : bool = x % 2 = 1 let ( +% ) = fadd let ( -% ) = fsub let ( *% ) = fmul let ( /% ) (x y:felem) = x *% finv y /// Scalar field // Group order let q : q:pos{q < pow2 256} = assert_norm (0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141 < pow2 256); 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141 let qelem = x:nat{x < q} let qadd (x y:qelem) : qelem = (x + y) % q let qmul (x y:qelem) : qelem = (x * y) % q let qinv (x:qelem) : qelem = M.pow_mod #q x (q - 2) let qnegate (x:qelem) : qelem = (- x) % q let scalar_is_high (x:qelem) : bool = x > q / 2 let ( +^ ) = qadd let ( *^ ) = qmul /// Elliptic curve let aff_point = felem & felem // Affine point let proj_point = felem & felem & felem // Projective coordinates // y * y = x * x * x + b let b : felem = 7 let is_on_curve (p:aff_point) = let x, y = p in y *% y = x *% x *% x +% b let aff_point_at_inf : aff_point = (zero, zero) // not on the curve! let point_at_inf : proj_point = (zero, one, zero) let is_aff_point_at_inf (p:aff_point) : bool = let (x, y) = p in x = zero && y = zero let is_proj_point_at_inf (p:proj_point) : bool = let (_, _, z) = p in z = zero let to_aff_point (p:proj_point) : aff_point = // if is_proj_point_at_inf p then aff_point_at_inf let (px, py, pz) = p in let zinv = finv pz in let x = px *% zinv in let y = py *% zinv in (x, y) let to_proj_point (p:aff_point) : proj_point = let (x, y) = p in (x, y, one) // Base point let g_x : felem = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 let g_y : felem = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 let g : proj_point = (g_x, g_y, one) /// Point addition in affine coordinates let aff_point_double (p:aff_point) : aff_point = let (px, py) = p in if is_aff_point_at_inf p then p else begin if py = 0 then aff_point_at_inf else begin let lambda = 3 *% px *% px /% (2 *% py) in let rx = lambda *% lambda -% px -% px in let ry = lambda *% (px -% rx) -% py in (rx, ry) end end let aff_point_add (p:aff_point) (q:aff_point) : aff_point = let (px, py) = p in let (qx, qy) = q in if is_aff_point_at_inf p then q else begin if is_aff_point_at_inf q then p else begin if p = q then aff_point_double p else begin if qx = px then aff_point_at_inf else begin let lambda = (qy -% py) /% (qx -% px) in let rx = lambda *% lambda -% px -% qx in let ry = lambda *% (px -% rx) -% py in (rx, ry) end end end end let aff_point_negate (p:aff_point) : aff_point = let x, y = p in x, (-y) % prime /// Point addition and doubling in projective coordinates let point_add (p:proj_point) (q:proj_point) : proj_point = let x1, y1, z1 = p in let x2, y2, z2 = q in let xx = x1 *% x2 in let yy = y1 *% y2 in let zz = z1 *% z2 in let xy_pairs = (x1 +% y1) *% (x2 +% y2) -% (xx +% yy) in let yz_pairs = (y1 +% z1) *% (y2 +% z2) -% (yy +% zz) in let xz_pairs = (x1 +% z1) *% (x2 +% z2) -% (xx +% zz) in let bzz3 = 3 *% b *% zz in let yy_m_bzz3 = yy -% bzz3 in let yy_p_bzz3 = yy +% bzz3 in let byz3 = 3 *% b *% yz_pairs in let xx3 = 3 *% xx in let bxx9 = 3 *% b *% xx3 in let x3 = xy_pairs *% yy_m_bzz3 -% byz3 *% xz_pairs in let y3 = yy_p_bzz3 *% yy_m_bzz3 +% bxx9 *% xz_pairs in let z3 = yz_pairs *% yy_p_bzz3 +% xx3 *% xy_pairs in x3, y3, z3 let point_double (p:proj_point) : proj_point = let x, y, z = p in let yy = y *% y in let zz = z *% z in let xy2 = 2 *% x *% y in let bzz3 = 3 *% b *% zz in let bzz9 = 3 *% bzz3 in let yy_m_bzz9 = yy -% bzz9 in let yy_p_bzz3 = yy +% bzz3 in let yy_zz = yy *% zz in let t = 24 *% b *% yy_zz in let x3 = xy2 *% yy_m_bzz9 in let y3 = yy_m_bzz9 *% yy_p_bzz3 +% t in let z3 = yy *% y *% z *% 8 in x3, y3, z3 let point_negate (p:proj_point) : proj_point = let x, y, z = p in x, (-y) % prime, z /// Point conversion between affine, projective and bytes representation let aff_point_load (b:BSeq.lbytes 64) : option aff_point = let pk_x = BSeq.nat_from_bytes_be (sub b 0 32) in let pk_y = BSeq.nat_from_bytes_be (sub b 32 32) in let is_x_valid = pk_x < prime in let is_y_valid = pk_y < prime in let is_xy_on_curve = if is_x_valid && is_y_valid then is_on_curve (pk_x, pk_y) else false in if is_xy_on_curve then Some (pk_x, pk_y) else None let load_point (b:BSeq.lbytes 64) : option proj_point = match (aff_point_load b) with | Some p -> Some (to_proj_point p) | None -> None
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.NatMod.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt8.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.K256.PointOps.fst" }
[ { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "BSeq" }, { "abbrev": true, "full_module": "Lib.NatMod", "short_module": "M" }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
b: Lib.ByteSequence.lbytes 64 -> Prims.bool
Prims.Tot
[ "total" ]
[]
[ "Lib.ByteSequence.lbytes", "Prims.op_AmpAmp", "Prims.op_LessThan", "Spec.K256.PointOps.prime", "Spec.K256.PointOps.is_on_curve", "FStar.Pervasives.Native.Mktuple2", "Spec.K256.PointOps.felem", "Prims.nat", "Prims.b2t", "Prims.pow2", "Prims.op_Multiply", "Lib.Sequence.length", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Lib.Sequence.sub", "Lib.ByteSequence.nat_from_bytes_be", "Lib.IntTypes.uint_t", "Prims.bool" ]
[]
false
false
false
false
false
let point_inv_bytes (b: BSeq.lbytes 64) =
let px = BSeq.nat_from_bytes_be (sub b 0 32) in let py = BSeq.nat_from_bytes_be (sub b 32 32) in px < prime && py < prime && is_on_curve (px, py)
false
Spec.K256.PointOps.fst
Spec.K256.PointOps.aff_point_load
val aff_point_load (b: BSeq.lbytes 64) : option aff_point
val aff_point_load (b: BSeq.lbytes 64) : option aff_point
let aff_point_load (b:BSeq.lbytes 64) : option aff_point = let pk_x = BSeq.nat_from_bytes_be (sub b 0 32) in let pk_y = BSeq.nat_from_bytes_be (sub b 32 32) in let is_x_valid = pk_x < prime in let is_y_valid = pk_y < prime in let is_xy_on_curve = if is_x_valid && is_y_valid then is_on_curve (pk_x, pk_y) else false in if is_xy_on_curve then Some (pk_x, pk_y) else None
{ "file_name": "specs/Spec.K256.PointOps.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 52, "end_line": 177, "start_col": 0, "start_line": 170 }
module Spec.K256.PointOps open FStar.Mul open Lib.IntTypes open Lib.Sequence module M = Lib.NatMod module BSeq = Lib.ByteSequence #set-options "--z3rlimit 30 --fuel 0 --ifuel 0" /// Finite field let prime : (p:pos{p = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F}) = assert_norm (24 < pow2 256 - 0x1000003D1); assert_norm (pow2 256 - 0x1000003D1 = pow2 256 - pow2 32 - pow2 9 - pow2 8 - pow2 7 - pow2 6 - pow2 4 - 1); assert_norm (pow2 256 - 0x1000003D1 = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F); pow2 256 - 0x1000003D1 let felem = x:nat{x < prime} let zero : felem = 0 let one : felem = 1 let fadd (x y:felem) : felem = (x + y) % prime let fsub (x y:felem) : felem = (x - y) % prime let fmul (x y:felem) : felem = (x * y) % prime let finv (x:felem) : felem = M.pow_mod #prime x (prime - 2) let fsqrt (x:felem) : felem = M.pow_mod #prime x ((prime + 1) / 4) let is_fodd (x:nat) : bool = x % 2 = 1 let ( +% ) = fadd let ( -% ) = fsub let ( *% ) = fmul let ( /% ) (x y:felem) = x *% finv y /// Scalar field // Group order let q : q:pos{q < pow2 256} = assert_norm (0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141 < pow2 256); 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141 let qelem = x:nat{x < q} let qadd (x y:qelem) : qelem = (x + y) % q let qmul (x y:qelem) : qelem = (x * y) % q let qinv (x:qelem) : qelem = M.pow_mod #q x (q - 2) let qnegate (x:qelem) : qelem = (- x) % q let scalar_is_high (x:qelem) : bool = x > q / 2 let ( +^ ) = qadd let ( *^ ) = qmul /// Elliptic curve let aff_point = felem & felem // Affine point let proj_point = felem & felem & felem // Projective coordinates // y * y = x * x * x + b let b : felem = 7 let is_on_curve (p:aff_point) = let x, y = p in y *% y = x *% x *% x +% b let aff_point_at_inf : aff_point = (zero, zero) // not on the curve! let point_at_inf : proj_point = (zero, one, zero) let is_aff_point_at_inf (p:aff_point) : bool = let (x, y) = p in x = zero && y = zero let is_proj_point_at_inf (p:proj_point) : bool = let (_, _, z) = p in z = zero let to_aff_point (p:proj_point) : aff_point = // if is_proj_point_at_inf p then aff_point_at_inf let (px, py, pz) = p in let zinv = finv pz in let x = px *% zinv in let y = py *% zinv in (x, y) let to_proj_point (p:aff_point) : proj_point = let (x, y) = p in (x, y, one) // Base point let g_x : felem = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 let g_y : felem = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 let g : proj_point = (g_x, g_y, one) /// Point addition in affine coordinates let aff_point_double (p:aff_point) : aff_point = let (px, py) = p in if is_aff_point_at_inf p then p else begin if py = 0 then aff_point_at_inf else begin let lambda = 3 *% px *% px /% (2 *% py) in let rx = lambda *% lambda -% px -% px in let ry = lambda *% (px -% rx) -% py in (rx, ry) end end let aff_point_add (p:aff_point) (q:aff_point) : aff_point = let (px, py) = p in let (qx, qy) = q in if is_aff_point_at_inf p then q else begin if is_aff_point_at_inf q then p else begin if p = q then aff_point_double p else begin if qx = px then aff_point_at_inf else begin let lambda = (qy -% py) /% (qx -% px) in let rx = lambda *% lambda -% px -% qx in let ry = lambda *% (px -% rx) -% py in (rx, ry) end end end end let aff_point_negate (p:aff_point) : aff_point = let x, y = p in x, (-y) % prime /// Point addition and doubling in projective coordinates let point_add (p:proj_point) (q:proj_point) : proj_point = let x1, y1, z1 = p in let x2, y2, z2 = q in let xx = x1 *% x2 in let yy = y1 *% y2 in let zz = z1 *% z2 in let xy_pairs = (x1 +% y1) *% (x2 +% y2) -% (xx +% yy) in let yz_pairs = (y1 +% z1) *% (y2 +% z2) -% (yy +% zz) in let xz_pairs = (x1 +% z1) *% (x2 +% z2) -% (xx +% zz) in let bzz3 = 3 *% b *% zz in let yy_m_bzz3 = yy -% bzz3 in let yy_p_bzz3 = yy +% bzz3 in let byz3 = 3 *% b *% yz_pairs in let xx3 = 3 *% xx in let bxx9 = 3 *% b *% xx3 in let x3 = xy_pairs *% yy_m_bzz3 -% byz3 *% xz_pairs in let y3 = yy_p_bzz3 *% yy_m_bzz3 +% bxx9 *% xz_pairs in let z3 = yz_pairs *% yy_p_bzz3 +% xx3 *% xy_pairs in x3, y3, z3 let point_double (p:proj_point) : proj_point = let x, y, z = p in let yy = y *% y in let zz = z *% z in let xy2 = 2 *% x *% y in let bzz3 = 3 *% b *% zz in let bzz9 = 3 *% bzz3 in let yy_m_bzz9 = yy -% bzz9 in let yy_p_bzz3 = yy +% bzz3 in let yy_zz = yy *% zz in let t = 24 *% b *% yy_zz in let x3 = xy2 *% yy_m_bzz9 in let y3 = yy_m_bzz9 *% yy_p_bzz3 +% t in let z3 = yy *% y *% z *% 8 in x3, y3, z3 let point_negate (p:proj_point) : proj_point = let x, y, z = p in x, (-y) % prime, z /// Point conversion between affine, projective and bytes representation
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.NatMod.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt8.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.K256.PointOps.fst" }
[ { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "BSeq" }, { "abbrev": true, "full_module": "Lib.NatMod", "short_module": "M" }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
b: Lib.ByteSequence.lbytes 64 -> FStar.Pervasives.Native.option Spec.K256.PointOps.aff_point
Prims.Tot
[ "total" ]
[]
[ "Lib.ByteSequence.lbytes", "FStar.Pervasives.Native.Some", "Spec.K256.PointOps.aff_point", "FStar.Pervasives.Native.Mktuple2", "Spec.K256.PointOps.felem", "Prims.bool", "FStar.Pervasives.Native.None", "FStar.Pervasives.Native.option", "Prims.op_AmpAmp", "Spec.K256.PointOps.is_on_curve", "Prims.op_LessThan", "Spec.K256.PointOps.prime", "Prims.nat", "Prims.b2t", "Prims.pow2", "Prims.op_Multiply", "Lib.Sequence.length", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Lib.Sequence.sub", "Lib.ByteSequence.nat_from_bytes_be", "Lib.IntTypes.uint_t" ]
[]
false
false
false
false
false
let aff_point_load (b: BSeq.lbytes 64) : option aff_point =
let pk_x = BSeq.nat_from_bytes_be (sub b 0 32) in let pk_y = BSeq.nat_from_bytes_be (sub b 32 32) in let is_x_valid = pk_x < prime in let is_y_valid = pk_y < prime in let is_xy_on_curve = if is_x_valid && is_y_valid then is_on_curve (pk_x, pk_y) else false in if is_xy_on_curve then Some (pk_x, pk_y) else None
false
Spec.K256.PointOps.fst
Spec.K256.PointOps.aff_point_decompress
val aff_point_decompress (s: BSeq.lbytes 33) : option aff_point
val aff_point_decompress (s: BSeq.lbytes 33) : option aff_point
let aff_point_decompress (s:BSeq.lbytes 33) : option aff_point = let s0 = Lib.RawIntTypes.u8_to_UInt8 s.[0] in if not (s0 = 0x02uy || s0 = 0x03uy) then None else begin let x = BSeq.nat_from_bytes_be (sub s 1 32) in let is_x_valid = x < prime in let is_y_odd = s0 = 0x03uy in if not is_x_valid then None else match (recover_y x is_y_odd) with | Some y -> Some (x, y) | None -> None end
{ "file_name": "specs/Spec.K256.PointOps.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 24, "end_line": 227, "start_col": 0, "start_line": 215 }
module Spec.K256.PointOps open FStar.Mul open Lib.IntTypes open Lib.Sequence module M = Lib.NatMod module BSeq = Lib.ByteSequence #set-options "--z3rlimit 30 --fuel 0 --ifuel 0" /// Finite field let prime : (p:pos{p = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F}) = assert_norm (24 < pow2 256 - 0x1000003D1); assert_norm (pow2 256 - 0x1000003D1 = pow2 256 - pow2 32 - pow2 9 - pow2 8 - pow2 7 - pow2 6 - pow2 4 - 1); assert_norm (pow2 256 - 0x1000003D1 = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F); pow2 256 - 0x1000003D1 let felem = x:nat{x < prime} let zero : felem = 0 let one : felem = 1 let fadd (x y:felem) : felem = (x + y) % prime let fsub (x y:felem) : felem = (x - y) % prime let fmul (x y:felem) : felem = (x * y) % prime let finv (x:felem) : felem = M.pow_mod #prime x (prime - 2) let fsqrt (x:felem) : felem = M.pow_mod #prime x ((prime + 1) / 4) let is_fodd (x:nat) : bool = x % 2 = 1 let ( +% ) = fadd let ( -% ) = fsub let ( *% ) = fmul let ( /% ) (x y:felem) = x *% finv y /// Scalar field // Group order let q : q:pos{q < pow2 256} = assert_norm (0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141 < pow2 256); 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141 let qelem = x:nat{x < q} let qadd (x y:qelem) : qelem = (x + y) % q let qmul (x y:qelem) : qelem = (x * y) % q let qinv (x:qelem) : qelem = M.pow_mod #q x (q - 2) let qnegate (x:qelem) : qelem = (- x) % q let scalar_is_high (x:qelem) : bool = x > q / 2 let ( +^ ) = qadd let ( *^ ) = qmul /// Elliptic curve let aff_point = felem & felem // Affine point let proj_point = felem & felem & felem // Projective coordinates // y * y = x * x * x + b let b : felem = 7 let is_on_curve (p:aff_point) = let x, y = p in y *% y = x *% x *% x +% b let aff_point_at_inf : aff_point = (zero, zero) // not on the curve! let point_at_inf : proj_point = (zero, one, zero) let is_aff_point_at_inf (p:aff_point) : bool = let (x, y) = p in x = zero && y = zero let is_proj_point_at_inf (p:proj_point) : bool = let (_, _, z) = p in z = zero let to_aff_point (p:proj_point) : aff_point = // if is_proj_point_at_inf p then aff_point_at_inf let (px, py, pz) = p in let zinv = finv pz in let x = px *% zinv in let y = py *% zinv in (x, y) let to_proj_point (p:aff_point) : proj_point = let (x, y) = p in (x, y, one) // Base point let g_x : felem = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 let g_y : felem = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 let g : proj_point = (g_x, g_y, one) /// Point addition in affine coordinates let aff_point_double (p:aff_point) : aff_point = let (px, py) = p in if is_aff_point_at_inf p then p else begin if py = 0 then aff_point_at_inf else begin let lambda = 3 *% px *% px /% (2 *% py) in let rx = lambda *% lambda -% px -% px in let ry = lambda *% (px -% rx) -% py in (rx, ry) end end let aff_point_add (p:aff_point) (q:aff_point) : aff_point = let (px, py) = p in let (qx, qy) = q in if is_aff_point_at_inf p then q else begin if is_aff_point_at_inf q then p else begin if p = q then aff_point_double p else begin if qx = px then aff_point_at_inf else begin let lambda = (qy -% py) /% (qx -% px) in let rx = lambda *% lambda -% px -% qx in let ry = lambda *% (px -% rx) -% py in (rx, ry) end end end end let aff_point_negate (p:aff_point) : aff_point = let x, y = p in x, (-y) % prime /// Point addition and doubling in projective coordinates let point_add (p:proj_point) (q:proj_point) : proj_point = let x1, y1, z1 = p in let x2, y2, z2 = q in let xx = x1 *% x2 in let yy = y1 *% y2 in let zz = z1 *% z2 in let xy_pairs = (x1 +% y1) *% (x2 +% y2) -% (xx +% yy) in let yz_pairs = (y1 +% z1) *% (y2 +% z2) -% (yy +% zz) in let xz_pairs = (x1 +% z1) *% (x2 +% z2) -% (xx +% zz) in let bzz3 = 3 *% b *% zz in let yy_m_bzz3 = yy -% bzz3 in let yy_p_bzz3 = yy +% bzz3 in let byz3 = 3 *% b *% yz_pairs in let xx3 = 3 *% xx in let bxx9 = 3 *% b *% xx3 in let x3 = xy_pairs *% yy_m_bzz3 -% byz3 *% xz_pairs in let y3 = yy_p_bzz3 *% yy_m_bzz3 +% bxx9 *% xz_pairs in let z3 = yz_pairs *% yy_p_bzz3 +% xx3 *% xy_pairs in x3, y3, z3 let point_double (p:proj_point) : proj_point = let x, y, z = p in let yy = y *% y in let zz = z *% z in let xy2 = 2 *% x *% y in let bzz3 = 3 *% b *% zz in let bzz9 = 3 *% bzz3 in let yy_m_bzz9 = yy -% bzz9 in let yy_p_bzz3 = yy +% bzz3 in let yy_zz = yy *% zz in let t = 24 *% b *% yy_zz in let x3 = xy2 *% yy_m_bzz9 in let y3 = yy_m_bzz9 *% yy_p_bzz3 +% t in let z3 = yy *% y *% z *% 8 in x3, y3, z3 let point_negate (p:proj_point) : proj_point = let x, y, z = p in x, (-y) % prime, z /// Point conversion between affine, projective and bytes representation let aff_point_load (b:BSeq.lbytes 64) : option aff_point = let pk_x = BSeq.nat_from_bytes_be (sub b 0 32) in let pk_y = BSeq.nat_from_bytes_be (sub b 32 32) in let is_x_valid = pk_x < prime in let is_y_valid = pk_y < prime in let is_xy_on_curve = if is_x_valid && is_y_valid then is_on_curve (pk_x, pk_y) else false in if is_xy_on_curve then Some (pk_x, pk_y) else None let load_point (b:BSeq.lbytes 64) : option proj_point = match (aff_point_load b) with | Some p -> Some (to_proj_point p) | None -> None let point_inv_bytes (b:BSeq.lbytes 64) = let px = BSeq.nat_from_bytes_be (sub b 0 32) in let py = BSeq.nat_from_bytes_be (sub b 32 32) in px < prime && py < prime && is_on_curve (px, py) let load_point_nocheck (b:BSeq.lbytes 64{point_inv_bytes b}) : proj_point = let px = BSeq.nat_from_bytes_be (sub b 0 32) in let py = BSeq.nat_from_bytes_be (sub b 32 32) in to_proj_point (px, py) let aff_point_store (p:aff_point) : BSeq.lbytes 64 = let (px, py) = p in let pxb = BSeq.nat_to_bytes_be 32 px in let pxy = BSeq.nat_to_bytes_be 32 py in concat #uint8 #32 #32 pxb pxy let point_store (p:proj_point) : BSeq.lbytes 64 = aff_point_store (to_aff_point p) let recover_y (x:felem) (is_odd:bool) : option felem = let y2 = x *% x *% x +% b in let y = fsqrt y2 in if y *% y <> y2 then None else begin let y = if is_fodd y <> is_odd then (prime - y) % prime else y in Some y end
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.NatMod.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.UInt8.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.K256.PointOps.fst" }
[ { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "BSeq" }, { "abbrev": true, "full_module": "Lib.NatMod", "short_module": "M" }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
s: Lib.ByteSequence.lbytes 33 -> FStar.Pervasives.Native.option Spec.K256.PointOps.aff_point
Prims.Tot
[ "total" ]
[]
[ "Lib.ByteSequence.lbytes", "Prims.op_Negation", "Prims.op_BarBar", "Prims.op_Equality", "FStar.UInt8.t", "FStar.UInt8.__uint_to_t", "FStar.Pervasives.Native.None", "Spec.K256.PointOps.aff_point", "Prims.bool", "Spec.K256.PointOps.recover_y", "Spec.K256.PointOps.felem", "FStar.Pervasives.Native.Some", "FStar.Pervasives.Native.Mktuple2", "FStar.Pervasives.Native.option", "Prims.op_LessThan", "Spec.K256.PointOps.prime", "Prims.nat", "Prims.b2t", "Prims.pow2", "Prims.op_Multiply", "Lib.Sequence.length", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Lib.Sequence.sub", "Lib.ByteSequence.nat_from_bytes_be", "Lib.IntTypes.uint_t", "Prims.int", "Prims.l_or", "Lib.IntTypes.range", "FStar.UInt.size", "Lib.IntTypes.v", "Lib.Sequence.index", "FStar.UInt8.v", "Lib.RawIntTypes.u8_to_UInt8", "Lib.Sequence.op_String_Access" ]
[]
false
false
false
false
false
let aff_point_decompress (s: BSeq.lbytes 33) : option aff_point =
let s0 = Lib.RawIntTypes.u8_to_UInt8 s.[ 0 ] in if not (s0 = 0x02uy || s0 = 0x03uy) then None else let x = BSeq.nat_from_bytes_be (sub s 1 32) in let is_x_valid = x < prime in let is_y_odd = s0 = 0x03uy in if not is_x_valid then None else match (recover_y x is_y_odd) with | Some y -> Some (x, y) | None -> None
false
Pulse.Checker.Exists.fsti
Pulse.Checker.Exists.intro_exists_vprop
val intro_exists_vprop : st: Pulse.Syntax.Base.st_term{Tm_IntroExists? (Mkst_term?.term st)} -> Pulse.Syntax.Base.vprop
let intro_exists_vprop (st:st_term { Tm_IntroExists? st.term }) = match st.term with | Tm_IntroExists { p } -> p
{ "file_name": "lib/steel/pulse/Pulse.Checker.Exists.fsti", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 29, "end_line": 41, "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 Pulse.Checker.Exists module T = FStar.Tactics.V2 open Pulse.Syntax open Pulse.Typing open Pulse.Checker.Base val check_elim_exists (g:env) (pre:term) (pre_typing:tot_typing g pre tm_vprop) (post_hint:post_hint_opt g) (res_ppname:ppname) (t:st_term{Tm_ElimExists? t.term}) : T.Tac (checker_result_t g pre post_hint) let intro_exists_witness_singleton (st:st_term) = match st.term with | Tm_IntroExists { witnesses = [_] } -> true | _ -> false
{ "checked_file": "/", "dependencies": [ "Pulse.Typing.fst.checked", "Pulse.Syntax.fst.checked", "Pulse.Checker.Base.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Pulse.Checker.Exists.fsti" }
[ { "abbrev": false, "full_module": "Pulse.Checker.Base", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
st: Pulse.Syntax.Base.st_term{Tm_IntroExists? (Mkst_term?.term st)} -> Pulse.Syntax.Base.vprop
Prims.Tot
[ "total" ]
[]
[ "Pulse.Syntax.Base.st_term", "Prims.b2t", "Pulse.Syntax.Base.uu___is_Tm_IntroExists", "Pulse.Syntax.Base.__proj__Mkst_term__item__term", "Pulse.Syntax.Base.vprop", "Prims.list", "Pulse.Syntax.Base.term" ]
[]
false
false
false
false
false
let intro_exists_vprop (st: st_term{Tm_IntroExists? st.term}) =
match st.term with | Tm_IntroExists { p = p } -> p
false
Spec.SecretBox.fst
Spec.SecretBox.size_nonce
val size_nonce : Prims.int
let size_nonce = 24
{ "file_name": "specs/Spec.SecretBox.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 19, "end_line": 12, "start_col": 0, "start_line": 12 }
module Spec.SecretBox open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence #set-options "--z3rlimit 30 --max_fuel 0 --max_ifuel 0" (* Constants *)
{ "checked_file": "/", "dependencies": [ "Spec.Salsa20.fst.checked", "Spec.Poly1305.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.SecretBox.fst" }
[ { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 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": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Prims.int
Prims.Tot
[ "total" ]
[]
[]
[]
false
false
false
true
false
let size_nonce =
24
false
Spec.SecretBox.fst
Spec.SecretBox.size_key
val size_key : Prims.int
let size_key = 32
{ "file_name": "specs/Spec.SecretBox.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 17, "end_line": 11, "start_col": 0, "start_line": 11 }
module Spec.SecretBox open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence #set-options "--z3rlimit 30 --max_fuel 0 --max_ifuel 0"
{ "checked_file": "/", "dependencies": [ "Spec.Salsa20.fst.checked", "Spec.Poly1305.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.SecretBox.fst" }
[ { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 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": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Prims.int
Prims.Tot
[ "total" ]
[]
[]
[]
false
false
false
true
false
let size_key =
32
false
Spec.SecretBox.fst
Spec.SecretBox.size_block
val size_block : Prims.int
let size_block = 64
{ "file_name": "specs/Spec.SecretBox.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 19, "end_line": 13, "start_col": 0, "start_line": 13 }
module Spec.SecretBox open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence #set-options "--z3rlimit 30 --max_fuel 0 --max_ifuel 0" (* Constants *) let size_key = 32 (* in bytes *)
{ "checked_file": "/", "dependencies": [ "Spec.Salsa20.fst.checked", "Spec.Poly1305.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.SecretBox.fst" }
[ { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 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": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Prims.int
Prims.Tot
[ "total" ]
[]
[]
[]
false
false
false
true
false
let size_block =
64
false
Spec.SecretBox.fst
Spec.SecretBox.size_tag
val size_tag : Prims.int
let size_tag = 16
{ "file_name": "specs/Spec.SecretBox.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 17, "end_line": 14, "start_col": 0, "start_line": 14 }
module Spec.SecretBox open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence #set-options "--z3rlimit 30 --max_fuel 0 --max_ifuel 0" (* Constants *) let size_key = 32 (* in bytes *) let size_nonce = 24 (* in bytes *)
{ "checked_file": "/", "dependencies": [ "Spec.Salsa20.fst.checked", "Spec.Poly1305.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.SecretBox.fst" }
[ { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 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": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Prims.int
Prims.Tot
[ "total" ]
[]
[]
[]
false
false
false
true
false
let size_tag =
16
false
Spec.SecretBox.fst
Spec.SecretBox.get_len0
val get_len0 (len: nat) : r: size_nat{r <= 32}
val get_len0 (len: nat) : r: size_nat{r <= 32}
let get_len0 (len:nat) : r:size_nat{r <= 32} = if len <= 32 then len else 32
{ "file_name": "specs/Spec.SecretBox.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 31, "end_line": 29, "start_col": 0, "start_line": 28 }
module Spec.SecretBox open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence #set-options "--z3rlimit 30 --max_fuel 0 --max_ifuel 0" (* Constants *) let size_key = 32 (* in bytes *) let size_nonce = 24 (* in bytes *) let size_block = 64 (* in bytes *) let size_tag = 16 (* in bytes *) type key = lbytes size_key type aekey = lbytes (size_key + size_key) type nonce = lbytes size_nonce type tag = lbytes size_tag let secretbox_init (k:key) (n:nonce) : key & aekey = let n0 : lbytes 16 = sub n 0 16 in let n1 : lbytes 8 = sub n 16 8 in let subkey : lbytes 32 = Spec.Salsa20.hsalsa20 k n0 in let aekey : lbytes 64 = Spec.Salsa20.salsa20_key_block0 subkey n1 in (subkey,aekey)
{ "checked_file": "/", "dependencies": [ "Spec.Salsa20.fst.checked", "Spec.Poly1305.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.SecretBox.fst" }
[ { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 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": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
len: Prims.nat -> r: Lib.IntTypes.size_nat{r <= 32}
Prims.Tot
[ "total" ]
[]
[ "Prims.nat", "Prims.op_LessThanOrEqual", "Prims.bool", "Lib.IntTypes.size_nat", "Prims.b2t" ]
[]
false
false
false
false
false
let get_len0 (len: nat) : r: size_nat{r <= 32} =
if len <= 32 then len else 32
false
Spec.SecretBox.fst
Spec.SecretBox.secretbox_init
val secretbox_init (k: key) (n: nonce) : key & aekey
val secretbox_init (k: key) (n: nonce) : key & aekey
let secretbox_init (k:key) (n:nonce) : key & aekey = let n0 : lbytes 16 = sub n 0 16 in let n1 : lbytes 8 = sub n 16 8 in let subkey : lbytes 32 = Spec.Salsa20.hsalsa20 k n0 in let aekey : lbytes 64 = Spec.Salsa20.salsa20_key_block0 subkey n1 in (subkey,aekey)
{ "file_name": "specs/Spec.SecretBox.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 16, "end_line": 26, "start_col": 0, "start_line": 21 }
module Spec.SecretBox open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence #set-options "--z3rlimit 30 --max_fuel 0 --max_ifuel 0" (* Constants *) let size_key = 32 (* in bytes *) let size_nonce = 24 (* in bytes *) let size_block = 64 (* in bytes *) let size_tag = 16 (* in bytes *) type key = lbytes size_key type aekey = lbytes (size_key + size_key) type nonce = lbytes size_nonce type tag = lbytes size_tag
{ "checked_file": "/", "dependencies": [ "Spec.Salsa20.fst.checked", "Spec.Poly1305.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.SecretBox.fst" }
[ { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 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": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
k: Spec.SecretBox.key -> n: Spec.SecretBox.nonce -> Spec.SecretBox.key * Spec.SecretBox.aekey
Prims.Tot
[ "total" ]
[]
[ "Spec.SecretBox.key", "Spec.SecretBox.nonce", "FStar.Pervasives.Native.Mktuple2", "Spec.SecretBox.aekey", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Salsa20.salsa20_key_block0", "Spec.Salsa20.hsalsa20", "Lib.Sequence.sub", "Lib.IntTypes.uint_t", "Spec.SecretBox.size_nonce", "FStar.Pervasives.Native.tuple2" ]
[]
false
false
false
true
false
let secretbox_init (k: key) (n: nonce) : key & aekey =
let n0:lbytes 16 = sub n 0 16 in let n1:lbytes 8 = sub n 16 8 in let subkey:lbytes 32 = Spec.Salsa20.hsalsa20 k n0 in let aekey:lbytes 64 = Spec.Salsa20.salsa20_key_block0 subkey n1 in (subkey, aekey)
false
Spec.SecretBox.fst
Spec.SecretBox.secretbox_easy
val secretbox_easy (k: key) (n: nonce) (m: bytes{length m / size_block <= max_size_t}) : c: bytes{length c = size_tag + length m}
val secretbox_easy (k: key) (n: nonce) (m: bytes{length m / size_block <= max_size_t}) : c: bytes{length c = size_tag + length m}
let secretbox_easy (k:key) (n:nonce) (m:bytes{length m / size_block <= max_size_t}) : c:bytes{length c = size_tag + length m} = let (tg,c) = secretbox_detached k n m in Seq.append tg c
{ "file_name": "specs/Spec.SecretBox.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 17, "end_line": 77, "start_col": 0, "start_line": 75 }
module Spec.SecretBox open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence #set-options "--z3rlimit 30 --max_fuel 0 --max_ifuel 0" (* Constants *) let size_key = 32 (* in bytes *) let size_nonce = 24 (* in bytes *) let size_block = 64 (* in bytes *) let size_tag = 16 (* in bytes *) type key = lbytes size_key type aekey = lbytes (size_key + size_key) type nonce = lbytes size_nonce type tag = lbytes size_tag let secretbox_init (k:key) (n:nonce) : key & aekey = let n0 : lbytes 16 = sub n 0 16 in let n1 : lbytes 8 = sub n 16 8 in let subkey : lbytes 32 = Spec.Salsa20.hsalsa20 k n0 in let aekey : lbytes 64 = Spec.Salsa20.salsa20_key_block0 subkey n1 in (subkey,aekey) let get_len0 (len:nat) : r:size_nat{r <= 32} = if len <= 32 then len else 32 let secretbox_detached (k:key) (n:nonce) (m:bytes{length m / size_block <= max_size_t}) : (tag & c:bytes{length c = length m}) = let (subkey,aekey) = secretbox_init k n in let n1 = sub n 16 8 in let mkey = sub aekey 0 32 in let ekey0 = sub aekey 32 32 in let mlen0 = get_len0 (length m) in let m0 = Seq.slice m 0 mlen0 in let m1 = Seq.slice m mlen0 (length m) in let block0 = create 32 (u8 0) in let block0 = update_sub block0 0 mlen0 m0 in let block0 = map2 (^.) block0 ekey0 in let c0 = sub block0 0 mlen0 in let c1 = Spec.Salsa20.salsa20_encrypt_bytes subkey n1 1 m1 in let c = Seq.append c0 c1 in let tg = Spec.Poly1305.poly1305_mac c mkey in (tg, c) let secretbox_open_detached (k:key) (n:nonce) (tg:tag) (c:bytes{length c / size_block <= max_size_t}) : option (m:bytes{length m = length c}) = let (subkey,aekey) = secretbox_init k n in let n1 = sub n 16 8 in let mkey = sub aekey 0 32 in let ekey0 = sub aekey 32 32 in let tg' = Spec.Poly1305.poly1305_mac c mkey in if Lib.ByteSequence.lbytes_eq tg tg' then ( let clen0 = get_len0 (length c) in let c0 = Seq.slice c 0 clen0 in let c1 = Seq.slice c clen0 (length c) in let block0 = create 32 (u8 0) in let block0 = update_sub block0 0 clen0 c0 in let block0 = map2 (^.) block0 ekey0 in let m0 = sub block0 0 clen0 in let m1 = Spec.Salsa20.salsa20_decrypt_bytes subkey n1 1 c1 in let m = Seq.append m0 m1 in Some m) else None
{ "checked_file": "/", "dependencies": [ "Spec.Salsa20.fst.checked", "Spec.Poly1305.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.SecretBox.fst" }
[ { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 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": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
k: Spec.SecretBox.key -> n: Spec.SecretBox.nonce -> m: Lib.ByteSequence.bytes {Lib.Sequence.length m / Spec.SecretBox.size_block <= Lib.IntTypes.max_size_t} -> c: Lib.ByteSequence.bytes{Lib.Sequence.length c = Spec.SecretBox.size_tag + Lib.Sequence.length m}
Prims.Tot
[ "total" ]
[]
[ "Spec.SecretBox.key", "Spec.SecretBox.nonce", "Lib.ByteSequence.bytes", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_Division", "Lib.Sequence.length", "Lib.IntTypes.uint_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.SecretBox.size_block", "Lib.IntTypes.max_size_t", "Spec.SecretBox.tag", "Prims.op_Equality", "Prims.nat", "FStar.Seq.Base.append", "Prims.int", "Prims.op_Addition", "Spec.SecretBox.size_tag", "FStar.Pervasives.Native.tuple2", "Lib.Sequence.seq", "Lib.IntTypes.int_t", "Spec.SecretBox.secretbox_detached" ]
[]
false
false
false
false
false
let secretbox_easy (k: key) (n: nonce) (m: bytes{length m / size_block <= max_size_t}) : c: bytes{length c = size_tag + length m} =
let tg, c = secretbox_detached k n m in Seq.append tg c
false
Spec.SecretBox.fst
Spec.SecretBox.secretbox_open_easy
val secretbox_open_easy (k: key) (n: nonce) (c: bytes{length c >= size_tag /\ (length c - size_tag) / size_block <= max_size_t}) : option (m: bytes{length m = length c - size_tag})
val secretbox_open_easy (k: key) (n: nonce) (c: bytes{length c >= size_tag /\ (length c - size_tag) / size_block <= max_size_t}) : option (m: bytes{length m = length c - size_tag})
let secretbox_open_easy (k:key) (n:nonce) (c:bytes{length c >= size_tag /\ (length c - size_tag) / size_block <= max_size_t}) : option (m:bytes{length m = length c - size_tag}) = let tg = Seq.slice c 0 size_tag in let e = Seq.slice c size_tag (length c) in secretbox_open_detached k n tg e
{ "file_name": "specs/Spec.SecretBox.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 34, "end_line": 82, "start_col": 0, "start_line": 79 }
module Spec.SecretBox open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence #set-options "--z3rlimit 30 --max_fuel 0 --max_ifuel 0" (* Constants *) let size_key = 32 (* in bytes *) let size_nonce = 24 (* in bytes *) let size_block = 64 (* in bytes *) let size_tag = 16 (* in bytes *) type key = lbytes size_key type aekey = lbytes (size_key + size_key) type nonce = lbytes size_nonce type tag = lbytes size_tag let secretbox_init (k:key) (n:nonce) : key & aekey = let n0 : lbytes 16 = sub n 0 16 in let n1 : lbytes 8 = sub n 16 8 in let subkey : lbytes 32 = Spec.Salsa20.hsalsa20 k n0 in let aekey : lbytes 64 = Spec.Salsa20.salsa20_key_block0 subkey n1 in (subkey,aekey) let get_len0 (len:nat) : r:size_nat{r <= 32} = if len <= 32 then len else 32 let secretbox_detached (k:key) (n:nonce) (m:bytes{length m / size_block <= max_size_t}) : (tag & c:bytes{length c = length m}) = let (subkey,aekey) = secretbox_init k n in let n1 = sub n 16 8 in let mkey = sub aekey 0 32 in let ekey0 = sub aekey 32 32 in let mlen0 = get_len0 (length m) in let m0 = Seq.slice m 0 mlen0 in let m1 = Seq.slice m mlen0 (length m) in let block0 = create 32 (u8 0) in let block0 = update_sub block0 0 mlen0 m0 in let block0 = map2 (^.) block0 ekey0 in let c0 = sub block0 0 mlen0 in let c1 = Spec.Salsa20.salsa20_encrypt_bytes subkey n1 1 m1 in let c = Seq.append c0 c1 in let tg = Spec.Poly1305.poly1305_mac c mkey in (tg, c) let secretbox_open_detached (k:key) (n:nonce) (tg:tag) (c:bytes{length c / size_block <= max_size_t}) : option (m:bytes{length m = length c}) = let (subkey,aekey) = secretbox_init k n in let n1 = sub n 16 8 in let mkey = sub aekey 0 32 in let ekey0 = sub aekey 32 32 in let tg' = Spec.Poly1305.poly1305_mac c mkey in if Lib.ByteSequence.lbytes_eq tg tg' then ( let clen0 = get_len0 (length c) in let c0 = Seq.slice c 0 clen0 in let c1 = Seq.slice c clen0 (length c) in let block0 = create 32 (u8 0) in let block0 = update_sub block0 0 clen0 c0 in let block0 = map2 (^.) block0 ekey0 in let m0 = sub block0 0 clen0 in let m1 = Spec.Salsa20.salsa20_decrypt_bytes subkey n1 1 c1 in let m = Seq.append m0 m1 in Some m) else None let secretbox_easy (k:key) (n:nonce) (m:bytes{length m / size_block <= max_size_t}) : c:bytes{length c = size_tag + length m} = let (tg,c) = secretbox_detached k n m in Seq.append tg c
{ "checked_file": "/", "dependencies": [ "Spec.Salsa20.fst.checked", "Spec.Poly1305.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.SecretBox.fst" }
[ { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 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": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
k: Spec.SecretBox.key -> n: Spec.SecretBox.nonce -> c: Lib.ByteSequence.bytes { Lib.Sequence.length c >= Spec.SecretBox.size_tag /\ (Lib.Sequence.length c - Spec.SecretBox.size_tag) / Spec.SecretBox.size_block <= Lib.IntTypes.max_size_t } -> FStar.Pervasives.Native.option (m: Lib.ByteSequence.bytes {Lib.Sequence.length m = Lib.Sequence.length c - Spec.SecretBox.size_tag})
Prims.Tot
[ "total" ]
[]
[ "Spec.SecretBox.key", "Spec.SecretBox.nonce", "Lib.ByteSequence.bytes", "Prims.l_and", "Prims.b2t", "Prims.op_GreaterThanOrEqual", "Lib.Sequence.length", "Lib.IntTypes.uint_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.SecretBox.size_tag", "Prims.op_LessThanOrEqual", "Prims.op_Division", "Prims.op_Subtraction", "Spec.SecretBox.size_block", "Lib.IntTypes.max_size_t", "Spec.SecretBox.secretbox_open_detached", "FStar.Seq.Base.seq", "Lib.IntTypes.int_t", "FStar.Seq.Base.slice", "FStar.Pervasives.Native.option", "Prims.op_Equality", "Prims.int" ]
[]
false
false
false
false
false
let secretbox_open_easy (k: key) (n: nonce) (c: bytes{length c >= size_tag /\ (length c - size_tag) / size_block <= max_size_t}) : option (m: bytes{length m = length c - size_tag}) =
let tg = Seq.slice c 0 size_tag in let e = Seq.slice c size_tag (length c) in secretbox_open_detached k n tg e
false
OPLSS.Ideal.fsti
OPLSS.Ideal.auth
val auth : OPLSS.Flag.flag
let auth = uf_cma
{ "file_name": "examples/crypto/OPLSS.Ideal.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 17, "end_line": 46, "start_col": 0, "start_line": 46 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module OPLSS.Ideal (* This interface captures the sequence of idealization steps that we'll make. Each concrete use of an idealization flag is a cryptographic hypothesis and should be treated as an `assume`, i.e., each such hypothesis should be validates as being cryptographically justified by an expert. *) open OPLSS.Flag //we're idealizing MACs val uf_cma : flag //after idealizing MAC's //we're pre-idealizing encryption, but without any loss of security val pre_ind_cpa : b:flag{ reveal b == reveal uf_cma } //finally, we're idealizing encryption for secrecy, at the end val ind_cpa : b:flag{ reveal b ==> reveal pre_ind_cpa } //we get authenticated encryption after idealizing everything // -- we write it this way to make explicit // that all the idealization flags are on, // rather than just ind_cpa val ae : b:flag{ reveal b = reveal pre_ind_cpa && reveal uf_cma && reveal ind_cpa }
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "OPLSS.Flag.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "OPLSS.Ideal.fsti" }
[ { "abbrev": false, "full_module": "OPLSS.Flag", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": 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
OPLSS.Flag.flag
Prims.Tot
[ "total" ]
[]
[ "OPLSS.Ideal.uf_cma" ]
[]
false
false
false
true
false
let auth =
uf_cma
false
OPLSS.Ideal.fsti
OPLSS.Ideal.conf
val conf : b: OPLSS.Flag.flag{OPLSS.Flag.reveal b ==> OPLSS.Flag.reveal OPLSS.Ideal.pre_ind_cpa}
let conf = ind_cpa
{ "file_name": "examples/crypto/OPLSS.Ideal.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 18, "end_line": 49, "start_col": 0, "start_line": 49 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module OPLSS.Ideal (* This interface captures the sequence of idealization steps that we'll make. Each concrete use of an idealization flag is a cryptographic hypothesis and should be treated as an `assume`, i.e., each such hypothesis should be validates as being cryptographically justified by an expert. *) open OPLSS.Flag //we're idealizing MACs val uf_cma : flag //after idealizing MAC's //we're pre-idealizing encryption, but without any loss of security val pre_ind_cpa : b:flag{ reveal b == reveal uf_cma } //finally, we're idealizing encryption for secrecy, at the end val ind_cpa : b:flag{ reveal b ==> reveal pre_ind_cpa } //we get authenticated encryption after idealizing everything // -- we write it this way to make explicit // that all the idealization flags are on, // rather than just ind_cpa val ae : b:flag{ reveal b = reveal pre_ind_cpa && reveal uf_cma && reveal ind_cpa } //we get authenticity when uf_cma is on let auth = uf_cma
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "OPLSS.Flag.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "OPLSS.Ideal.fsti" }
[ { "abbrev": false, "full_module": "OPLSS.Flag", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "OPLSS", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": 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: OPLSS.Flag.flag{OPLSS.Flag.reveal b ==> OPLSS.Flag.reveal OPLSS.Ideal.pre_ind_cpa}
Prims.Tot
[ "total" ]
[]
[ "OPLSS.Ideal.ind_cpa" ]
[]
false
false
false
false
false
let conf =
ind_cpa
false
Hacl.Frodo.Random.fst
Hacl.Frodo.Random.state
val state: b:lbuffer uint8 48ul{ recallable b }
val state: b:lbuffer uint8 48ul{ recallable b }
let state = gcmalloc HyperStack.root 0uy 48ul
{ "file_name": "code/frodo/Hacl.Frodo.Random.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 45, "end_line": 19, "start_col": 0, "start_line": 19 }
module Hacl.Frodo.Random open FStar.HyperStack.All open LowStar.Buffer open Lib.IntTypes open Lib.Buffer module S = Spec.Frodo.Random (* Stub stateless implementation on top of Lib.RandomBuffer.System. Intended to be replaced for KATs with include/rng.c *) friend Lib.IntTypes #set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
{ "checked_file": "/", "dependencies": [ "Spec.Frodo.Random.fst.checked", "prims.fst.checked", "LowStar.Buffer.fst.checked", "Lib.RandomBuffer.System.fsti.checked", "Lib.IntTypes.fst.checked", "Lib.IntTypes.fst.checked", "Lib.Buffer.fsti.checked", "FStar.UInt8.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": true, "source_file": "Hacl.Frodo.Random.fst" }
[ { "abbrev": true, "full_module": "Spec.Frodo.Random", "short_module": "S" }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": true, "full_module": "Spec.Frodo.Random", "short_module": "S" }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Frodo", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Frodo", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": 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
b: Lib.Buffer.lbuffer Lib.IntTypes.uint8 48ul {Lib.Buffer.recallable b}
Prims.Tot
[ "total" ]
[]
[ "LowStar.Buffer.gcmalloc", "FStar.UInt8.t", "FStar.Monotonic.HyperHeap.root", "FStar.UInt8.__uint_to_t", "FStar.UInt32.__uint_to_t", "LowStar.Monotonic.Buffer.mbuffer", "LowStar.Buffer.trivial_preorder", "Prims.l_and", "Prims.eq2", "Prims.nat", "LowStar.Monotonic.Buffer.length", "FStar.UInt32.v", "Prims.b2t", "Prims.op_Negation", "LowStar.Monotonic.Buffer.g_is_null", "FStar.Monotonic.HyperHeap.rid", "LowStar.Monotonic.Buffer.frameOf", "LowStar.Monotonic.Buffer.recallable" ]
[]
false
false
false
false
false
let state =
gcmalloc HyperStack.root 0uy 48ul
false
Spec.SecretBox.fst
Spec.SecretBox.secretbox_detached
val secretbox_detached (k: key) (n: nonce) (m: bytes{length m / size_block <= max_size_t}) : (tag & c: bytes{length c = length m})
val secretbox_detached (k: key) (n: nonce) (m: bytes{length m / size_block <= max_size_t}) : (tag & c: bytes{length c = length m})
let secretbox_detached (k:key) (n:nonce) (m:bytes{length m / size_block <= max_size_t}) : (tag & c:bytes{length c = length m}) = let (subkey,aekey) = secretbox_init k n in let n1 = sub n 16 8 in let mkey = sub aekey 0 32 in let ekey0 = sub aekey 32 32 in let mlen0 = get_len0 (length m) in let m0 = Seq.slice m 0 mlen0 in let m1 = Seq.slice m mlen0 (length m) in let block0 = create 32 (u8 0) in let block0 = update_sub block0 0 mlen0 m0 in let block0 = map2 (^.) block0 ekey0 in let c0 = sub block0 0 mlen0 in let c1 = Spec.Salsa20.salsa20_encrypt_bytes subkey n1 1 m1 in let c = Seq.append c0 c1 in let tg = Spec.Poly1305.poly1305_mac c mkey in (tg, c)
{ "file_name": "specs/Spec.SecretBox.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 9, "end_line": 50, "start_col": 0, "start_line": 31 }
module Spec.SecretBox open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence #set-options "--z3rlimit 30 --max_fuel 0 --max_ifuel 0" (* Constants *) let size_key = 32 (* in bytes *) let size_nonce = 24 (* in bytes *) let size_block = 64 (* in bytes *) let size_tag = 16 (* in bytes *) type key = lbytes size_key type aekey = lbytes (size_key + size_key) type nonce = lbytes size_nonce type tag = lbytes size_tag let secretbox_init (k:key) (n:nonce) : key & aekey = let n0 : lbytes 16 = sub n 0 16 in let n1 : lbytes 8 = sub n 16 8 in let subkey : lbytes 32 = Spec.Salsa20.hsalsa20 k n0 in let aekey : lbytes 64 = Spec.Salsa20.salsa20_key_block0 subkey n1 in (subkey,aekey) let get_len0 (len:nat) : r:size_nat{r <= 32} = if len <= 32 then len else 32
{ "checked_file": "/", "dependencies": [ "Spec.Salsa20.fst.checked", "Spec.Poly1305.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.SecretBox.fst" }
[ { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 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": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
k: Spec.SecretBox.key -> n: Spec.SecretBox.nonce -> m: Lib.ByteSequence.bytes {Lib.Sequence.length m / Spec.SecretBox.size_block <= Lib.IntTypes.max_size_t} -> Spec.SecretBox.tag * c: Lib.ByteSequence.bytes{Lib.Sequence.length c = Lib.Sequence.length m}
Prims.Tot
[ "total" ]
[]
[ "Spec.SecretBox.key", "Spec.SecretBox.nonce", "Lib.ByteSequence.bytes", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_Division", "Lib.Sequence.length", "Lib.IntTypes.uint_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.SecretBox.size_block", "Lib.IntTypes.max_size_t", "Spec.SecretBox.aekey", "FStar.Pervasives.Native.Mktuple2", "Spec.SecretBox.tag", "Prims.op_Equality", "Prims.nat", "Spec.Poly1305.tag", "Spec.Poly1305.poly1305_mac", "FStar.Seq.Base.seq", "Lib.IntTypes.int_t", "FStar.Seq.Base.append", "Lib.Sequence.seq", "Prims.eq2", "Spec.Salsa20.salsa20_encrypt_bytes", "Lib.Sequence.lseq", "Prims.l_and", "Lib.Sequence.to_seq", "FStar.Seq.Base.slice", "Prims.op_Addition", "Prims.l_Forall", "Prims.op_LessThan", "Prims.l_or", "FStar.Seq.Base.index", "Lib.Sequence.index", "Lib.Sequence.sub", "Prims.l_imp", "Lib.IntTypes.logxor", "Lib.Sequence.map2", "Lib.IntTypes.op_Hat_Dot", "Lib.Sequence.update_sub", "FStar.Seq.Base.create", "Lib.IntTypes.mk_int", "Lib.Sequence.create", "Lib.IntTypes.u8", "Prims.op_Subtraction", "Prims.pow2", "Spec.SecretBox.get_len0", "Spec.SecretBox.size_key", "Spec.SecretBox.size_nonce", "FStar.Pervasives.Native.tuple2", "Spec.SecretBox.secretbox_init" ]
[]
false
false
false
false
false
let secretbox_detached (k: key) (n: nonce) (m: bytes{length m / size_block <= max_size_t}) : (tag & c: bytes{length c = length m}) =
let subkey, aekey = secretbox_init k n in let n1 = sub n 16 8 in let mkey = sub aekey 0 32 in let ekey0 = sub aekey 32 32 in let mlen0 = get_len0 (length m) in let m0 = Seq.slice m 0 mlen0 in let m1 = Seq.slice m mlen0 (length m) in let block0 = create 32 (u8 0) in let block0 = update_sub block0 0 mlen0 m0 in let block0 = map2 ( ^. ) block0 ekey0 in let c0 = sub block0 0 mlen0 in let c1 = Spec.Salsa20.salsa20_encrypt_bytes subkey n1 1 m1 in let c = Seq.append c0 c1 in let tg = Spec.Poly1305.poly1305_mac c mkey in (tg, c)
false
Spec.SecretBox.fst
Spec.SecretBox.secretbox_open_detached
val secretbox_open_detached (k: key) (n: nonce) (tg: tag) (c: bytes{length c / size_block <= max_size_t}) : option (m: bytes{length m = length c})
val secretbox_open_detached (k: key) (n: nonce) (tg: tag) (c: bytes{length c / size_block <= max_size_t}) : option (m: bytes{length m = length c})
let secretbox_open_detached (k:key) (n:nonce) (tg:tag) (c:bytes{length c / size_block <= max_size_t}) : option (m:bytes{length m = length c}) = let (subkey,aekey) = secretbox_init k n in let n1 = sub n 16 8 in let mkey = sub aekey 0 32 in let ekey0 = sub aekey 32 32 in let tg' = Spec.Poly1305.poly1305_mac c mkey in if Lib.ByteSequence.lbytes_eq tg tg' then ( let clen0 = get_len0 (length c) in let c0 = Seq.slice c 0 clen0 in let c1 = Seq.slice c clen0 (length c) in let block0 = create 32 (u8 0) in let block0 = update_sub block0 0 clen0 c0 in let block0 = map2 (^.) block0 ekey0 in let m0 = sub block0 0 clen0 in let m1 = Spec.Salsa20.salsa20_decrypt_bytes subkey n1 1 c1 in let m = Seq.append m0 m1 in Some m) else None
{ "file_name": "specs/Spec.SecretBox.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 11, "end_line": 73, "start_col": 0, "start_line": 52 }
module Spec.SecretBox open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence #set-options "--z3rlimit 30 --max_fuel 0 --max_ifuel 0" (* Constants *) let size_key = 32 (* in bytes *) let size_nonce = 24 (* in bytes *) let size_block = 64 (* in bytes *) let size_tag = 16 (* in bytes *) type key = lbytes size_key type aekey = lbytes (size_key + size_key) type nonce = lbytes size_nonce type tag = lbytes size_tag let secretbox_init (k:key) (n:nonce) : key & aekey = let n0 : lbytes 16 = sub n 0 16 in let n1 : lbytes 8 = sub n 16 8 in let subkey : lbytes 32 = Spec.Salsa20.hsalsa20 k n0 in let aekey : lbytes 64 = Spec.Salsa20.salsa20_key_block0 subkey n1 in (subkey,aekey) let get_len0 (len:nat) : r:size_nat{r <= 32} = if len <= 32 then len else 32 let secretbox_detached (k:key) (n:nonce) (m:bytes{length m / size_block <= max_size_t}) : (tag & c:bytes{length c = length m}) = let (subkey,aekey) = secretbox_init k n in let n1 = sub n 16 8 in let mkey = sub aekey 0 32 in let ekey0 = sub aekey 32 32 in let mlen0 = get_len0 (length m) in let m0 = Seq.slice m 0 mlen0 in let m1 = Seq.slice m mlen0 (length m) in let block0 = create 32 (u8 0) in let block0 = update_sub block0 0 mlen0 m0 in let block0 = map2 (^.) block0 ekey0 in let c0 = sub block0 0 mlen0 in let c1 = Spec.Salsa20.salsa20_encrypt_bytes subkey n1 1 m1 in let c = Seq.append c0 c1 in let tg = Spec.Poly1305.poly1305_mac c mkey in (tg, c)
{ "checked_file": "/", "dependencies": [ "Spec.Salsa20.fst.checked", "Spec.Poly1305.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.SecretBox.fst" }
[ { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "Spec", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 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": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
k: Spec.SecretBox.key -> n: Spec.SecretBox.nonce -> tg: Spec.SecretBox.tag -> c: Lib.ByteSequence.bytes {Lib.Sequence.length c / Spec.SecretBox.size_block <= Lib.IntTypes.max_size_t} -> FStar.Pervasives.Native.option (m: Lib.ByteSequence.bytes{Lib.Sequence.length m = Lib.Sequence.length c})
Prims.Tot
[ "total" ]
[]
[ "Spec.SecretBox.key", "Spec.SecretBox.nonce", "Spec.SecretBox.tag", "Lib.ByteSequence.bytes", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_Division", "Lib.Sequence.length", "Lib.IntTypes.uint_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.SecretBox.size_block", "Lib.IntTypes.max_size_t", "Spec.SecretBox.aekey", "Lib.ByteSequence.lbytes_eq", "Spec.SecretBox.size_tag", "FStar.Pervasives.Native.Some", "Prims.op_Equality", "Prims.nat", "FStar.Seq.Base.seq", "Lib.IntTypes.int_t", "FStar.Seq.Base.append", "Lib.Sequence.seq", "Prims.eq2", "Spec.Salsa20.salsa20_decrypt_bytes", "Lib.Sequence.lseq", "Prims.l_and", "Lib.Sequence.to_seq", "FStar.Seq.Base.slice", "Prims.op_Addition", "Prims.l_Forall", "Prims.op_LessThan", "Prims.l_or", "FStar.Seq.Base.index", "Lib.Sequence.index", "Lib.Sequence.sub", "Prims.l_imp", "Lib.IntTypes.logxor", "Lib.Sequence.map2", "Lib.IntTypes.op_Hat_Dot", "Lib.Sequence.update_sub", "FStar.Seq.Base.create", "Lib.IntTypes.mk_int", "Lib.Sequence.create", "Lib.IntTypes.u8", "Prims.op_Subtraction", "Prims.pow2", "Spec.SecretBox.get_len0", "Prims.bool", "FStar.Pervasives.Native.None", "FStar.Pervasives.Native.option", "Spec.Poly1305.tag", "Spec.Poly1305.poly1305_mac", "Spec.SecretBox.size_key", "Spec.SecretBox.size_nonce", "FStar.Pervasives.Native.tuple2", "Spec.SecretBox.secretbox_init" ]
[]
false
false
false
false
false
let secretbox_open_detached (k: key) (n: nonce) (tg: tag) (c: bytes{length c / size_block <= max_size_t}) : option (m: bytes{length m = length c}) =
let subkey, aekey = secretbox_init k n in let n1 = sub n 16 8 in let mkey = sub aekey 0 32 in let ekey0 = sub aekey 32 32 in let tg' = Spec.Poly1305.poly1305_mac c mkey in if Lib.ByteSequence.lbytes_eq tg tg' then (let clen0 = get_len0 (length c) in let c0 = Seq.slice c 0 clen0 in let c1 = Seq.slice c clen0 (length c) in let block0 = create 32 (u8 0) in let block0 = update_sub block0 0 clen0 c0 in let block0 = map2 ( ^. ) block0 ekey0 in let m0 = sub block0 0 clen0 in let m1 = Spec.Salsa20.salsa20_decrypt_bytes subkey n1 1 c1 in let m = Seq.append m0 m1 in Some m) else None
false
FStar.ConstantTime.Integers.fst
FStar.ConstantTime.Integers.hide
val hide (#sl:sl) (#l:lattice_element sl) (#s:sw) (x:int{within_bounds s x}) : GTot (secret_int l s)
val hide (#sl:sl) (#l:lattice_element sl) (#s:sw) (x:int{within_bounds s x}) : GTot (secret_int l s)
let hide (#sl:sl) (#l:lattice_element sl) (#s:sw) (x:int{within_bounds s x}) : GTot (secret_int l s) = return l (u x)
{ "file_name": "ulib/experimental/FStar.ConstantTime.Integers.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 18, "end_line": 48, "start_col": 0, "start_line": 46 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.ConstantTime.Integers (** This module provides a refinement of FStar.IFC providing an interface restricted only to constant-time operations on integers. In contrast, FStar.IFC provides a general monadic information-flow control framework, which need not be restricted to constant-time operations. *) open FStar.IFC open FStar.Integers /// A `secret_int l s` is a machine-integer at secrecy level `l` and /// signedness/width `s`. let secret_int (#sl:sl) (l:lattice_element sl) (s:sw) : Type0 = protected l (int_t s) /// A `secret_int l s` can be seen as an int in spec let reveal (#sl:sl) (#l:lattice_element sl) (#s:sw) (x:secret_int l s) : GTot (y:int{within_bounds s y}) = v (reveal x)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Integers.fst.checked", "FStar.IFC.fsti.checked" ], "interface_file": true, "source_file": "FStar.ConstantTime.Integers.fst" }
[ { "abbrev": false, "full_module": "FStar.Integers", "short_module": null }, { "abbrev": false, "full_module": "FStar.IFC", "short_module": null }, { "abbrev": false, "full_module": "FStar.ConstantTime", "short_module": null }, { "abbrev": false, "full_module": "FStar.ConstantTime", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: FStar.Integers.int{FStar.Integers.within_bounds s x} -> Prims.GTot (FStar.ConstantTime.Integers.secret_int l s)
Prims.GTot
[ "sometrivial" ]
[]
[ "FStar.IFC.sl", "FStar.IFC.lattice_element", "FStar.ConstantTime.Integers.sw", "FStar.Integers.int", "FStar.Integers.within_bounds", "FStar.IFC.return", "FStar.Integers.int_t", "FStar.Integers.u", "FStar.ConstantTime.Integers.secret_int" ]
[]
false
false
false
false
false
let hide (#sl: sl) (#l: lattice_element sl) (#s: sw) (x: int{within_bounds s x}) : GTot (secret_int l s) =
return l (u x)
false
FStar.ConstantTime.Integers.fst
FStar.ConstantTime.Integers.secret_int
val secret_int (#sl:sl u#c) (l:lattice_element sl) (s:sw) : Type0
val secret_int (#sl:sl u#c) (l:lattice_element sl) (s:sw) : Type0
let secret_int (#sl:sl) (l:lattice_element sl) (s:sw) : Type0 = protected l (int_t s)
{ "file_name": "ulib/experimental/FStar.ConstantTime.Integers.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 25, "end_line": 35, "start_col": 0, "start_line": 32 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.ConstantTime.Integers (** This module provides a refinement of FStar.IFC providing an interface restricted only to constant-time operations on integers. In contrast, FStar.IFC provides a general monadic information-flow control framework, which need not be restricted to constant-time operations. *) open FStar.IFC open FStar.Integers /// A `secret_int l s` is a machine-integer at secrecy level `l` and
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Integers.fst.checked", "FStar.IFC.fsti.checked" ], "interface_file": true, "source_file": "FStar.ConstantTime.Integers.fst" }
[ { "abbrev": false, "full_module": "FStar.Integers", "short_module": null }, { "abbrev": false, "full_module": "FStar.IFC", "short_module": null }, { "abbrev": false, "full_module": "FStar.ConstantTime", "short_module": null }, { "abbrev": false, "full_module": "FStar.ConstantTime", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": 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: FStar.IFC.lattice_element sl -> s: FStar.ConstantTime.Integers.sw -> Type0
Prims.Tot
[ "total" ]
[]
[ "FStar.IFC.sl", "FStar.IFC.lattice_element", "FStar.ConstantTime.Integers.sw", "FStar.IFC.protected", "FStar.Integers.int_t" ]
[]
false
false
false
false
true
let secret_int (#sl: sl) (l: lattice_element sl) (s: sw) : Type0 =
protected l (int_t s)
false
FStar.ConstantTime.Integers.fst
FStar.ConstantTime.Integers.reveal
val reveal (#sl:sl) (#l:lattice_element sl) (#s:sw) (x:secret_int l s) : GTot (y:int{within_bounds s y})
val reveal (#sl:sl) (#l:lattice_element sl) (#s:sw) (x:secret_int l s) : GTot (y:int{within_bounds s y})
let reveal (#sl:sl) (#l:lattice_element sl) (#s:sw) (x:secret_int l s) : GTot (y:int{within_bounds s y}) = v (reveal x)
{ "file_name": "ulib/experimental/FStar.ConstantTime.Integers.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 17, "end_line": 43, "start_col": 0, "start_line": 38 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.ConstantTime.Integers (** This module provides a refinement of FStar.IFC providing an interface restricted only to constant-time operations on integers. In contrast, FStar.IFC provides a general monadic information-flow control framework, which need not be restricted to constant-time operations. *) open FStar.IFC open FStar.Integers /// A `secret_int l s` is a machine-integer at secrecy level `l` and /// signedness/width `s`. let secret_int (#sl:sl) (l:lattice_element sl) (s:sw) : Type0 = protected l (int_t s)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Integers.fst.checked", "FStar.IFC.fsti.checked" ], "interface_file": true, "source_file": "FStar.ConstantTime.Integers.fst" }
[ { "abbrev": false, "full_module": "FStar.Integers", "short_module": null }, { "abbrev": false, "full_module": "FStar.IFC", "short_module": null }, { "abbrev": false, "full_module": "FStar.ConstantTime", "short_module": null }, { "abbrev": false, "full_module": "FStar.ConstantTime", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: FStar.ConstantTime.Integers.secret_int l s -> Prims.GTot (y: FStar.Integers.int{FStar.Integers.within_bounds s y})
Prims.GTot
[ "sometrivial" ]
[]
[ "FStar.IFC.sl", "FStar.IFC.lattice_element", "FStar.ConstantTime.Integers.sw", "FStar.ConstantTime.Integers.secret_int", "FStar.Integers.v", "FStar.IFC.reveal", "FStar.Integers.int_t", "FStar.Integers.int", "FStar.Integers.within_bounds" ]
[]
false
false
false
false
false
let reveal (#sl: sl) (#l: lattice_element sl) (#s: sw) (x: secret_int l s) : GTot (y: int{within_bounds s y}) =
v (reveal x)
false
FStar.ConstantTime.Integers.fst
FStar.ConstantTime.Integers.promote
val promote (#sl:sl) (#l0:lattice_element sl) (#s:sw) (x:secret_int l0 s) (l1:lattice_element sl) : Tot (y:secret_int (l1 `lub` l0) s{reveal y == reveal x})
val promote (#sl:sl) (#l0:lattice_element sl) (#s:sw) (x:secret_int l0 s) (l1:lattice_element sl) : Tot (y:secret_int (l1 `lub` l0) s{reveal y == reveal x})
let promote #sl #l0 #s x l1 = join (return #_ #(secret_int l0 s) l1 x)
{ "file_name": "ulib/experimental/FStar.ConstantTime.Integers.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 44, "end_line": 54, "start_col": 0, "start_line": 53 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.ConstantTime.Integers (** This module provides a refinement of FStar.IFC providing an interface restricted only to constant-time operations on integers. In contrast, FStar.IFC provides a general monadic information-flow control framework, which need not be restricted to constant-time operations. *) open FStar.IFC open FStar.Integers /// A `secret_int l s` is a machine-integer at secrecy level `l` and /// signedness/width `s`. let secret_int (#sl:sl) (l:lattice_element sl) (s:sw) : Type0 = protected l (int_t s) /// A `secret_int l s` can be seen as an int in spec let reveal (#sl:sl) (#l:lattice_element sl) (#s:sw) (x:secret_int l s) : GTot (y:int{within_bounds s y}) = v (reveal x) /// `hide` is the inverse of `reveal`, proving that `secret_int` is injective let hide (#sl:sl) (#l:lattice_element sl) (#s:sw) (x:int{within_bounds s x}) : GTot (secret_int l s) = return l (u x) let reveal_hide #sl #l #s x = () let hide_reveal #sl #l #s x = ()
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Integers.fst.checked", "FStar.IFC.fsti.checked" ], "interface_file": true, "source_file": "FStar.ConstantTime.Integers.fst" }
[ { "abbrev": false, "full_module": "FStar.Integers", "short_module": null }, { "abbrev": false, "full_module": "FStar.IFC", "short_module": null }, { "abbrev": false, "full_module": "FStar.ConstantTime", "short_module": null }, { "abbrev": false, "full_module": "FStar.ConstantTime", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: FStar.ConstantTime.Integers.secret_int l0 s -> l1: FStar.IFC.lattice_element sl -> y: FStar.ConstantTime.Integers.secret_int (FStar.IFC.lub l1 l0) s {FStar.ConstantTime.Integers.reveal y == FStar.ConstantTime.Integers.reveal x}
Prims.Tot
[ "total" ]
[]
[ "FStar.IFC.sl", "FStar.IFC.lattice_element", "FStar.ConstantTime.Integers.sw", "FStar.ConstantTime.Integers.secret_int", "FStar.IFC.join", "FStar.Integers.int_t", "FStar.IFC.return", "FStar.IFC.lub", "Prims.eq2", "FStar.Integers.int", "Prims.l_or", "FStar.Integers.within_bounds", "FStar.ConstantTime.Integers.reveal" ]
[]
false
false
false
false
false
let promote #sl #l0 #s x l1 =
join (return #_ #(secret_int l0 s) l1 x)
false
FStar.ConstantTime.Integers.fst
FStar.ConstantTime.Integers.addition_mod
val addition_mod (#sl:sl) (#l:lattice_element sl) (#sw: _ {Unsigned? sw /\ width_of_sw sw <> W128}) (x : secret_int l sw) (y : secret_int l sw) : Tot (z:secret_int l sw { m z == m x +% m y } )
val addition_mod (#sl:sl) (#l:lattice_element sl) (#sw: _ {Unsigned? sw /\ width_of_sw sw <> W128}) (x : secret_int l sw) (y : secret_int l sw) : Tot (z:secret_int l sw { m z == m x +% m y } )
let addition_mod (#sl:sl) (#l:lattice_element sl) (#sw: _ {Unsigned? sw /\ width_of_sw sw <> W128}) (x : secret_int l sw) (y : secret_int l sw) : Tot (z:secret_int l sw { m z == m x +% m y } ) = let>> a = x in let>> b = y in return l (a +% b)
{ "file_name": "ulib/experimental/FStar.ConstantTime.Integers.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 23, "end_line": 84, "start_col": 0, "start_line": 76 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.ConstantTime.Integers (** This module provides a refinement of FStar.IFC providing an interface restricted only to constant-time operations on integers. In contrast, FStar.IFC provides a general monadic information-flow control framework, which need not be restricted to constant-time operations. *) open FStar.IFC open FStar.Integers /// A `secret_int l s` is a machine-integer at secrecy level `l` and /// signedness/width `s`. let secret_int (#sl:sl) (l:lattice_element sl) (s:sw) : Type0 = protected l (int_t s) /// A `secret_int l s` can be seen as an int in spec let reveal (#sl:sl) (#l:lattice_element sl) (#s:sw) (x:secret_int l s) : GTot (y:int{within_bounds s y}) = v (reveal x) /// `hide` is the inverse of `reveal`, proving that `secret_int` is injective let hide (#sl:sl) (#l:lattice_element sl) (#s:sw) (x:int{within_bounds s x}) : GTot (secret_int l s) = return l (u x) let reveal_hide #sl #l #s x = () let hide_reveal #sl #l #s x = () let promote #sl #l0 #s x l1 = join (return #_ #(secret_int l0 s) l1 x) ////////////////////////////////////////////////////////////////////////////////////////// /// The remainder of this module provides liftings of specific integers operations /// to work on secret integers, i.e., only those that respect the constant time guarantees /// and do not break confidentiality. /// /// Note, with our choice of representation, it is impossible to /// implement functions that break basic IFC guarantees, e.g., we /// cannot implement a boolean comparison function on secret_ints noextract inline_for_extraction let addition #sl (#l:lattice_element sl) #s (x : secret_int l s) (y : secret_int l s {ok ( + ) (m x) (m y)}) : Tot (z:secret_int l s{m z == m x + m y}) = let>> a = x in let>> b = y in return l (a + b) noextract
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Integers.fst.checked", "FStar.IFC.fsti.checked" ], "interface_file": true, "source_file": "FStar.ConstantTime.Integers.fst" }
[ { "abbrev": false, "full_module": "FStar.Integers", "short_module": null }, { "abbrev": false, "full_module": "FStar.IFC", "short_module": null }, { "abbrev": false, "full_module": "FStar.ConstantTime", "short_module": null }, { "abbrev": false, "full_module": "FStar.ConstantTime", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: FStar.ConstantTime.Integers.secret_int l sw -> y: FStar.ConstantTime.Integers.secret_int l sw -> z: FStar.ConstantTime.Integers.secret_int l sw { FStar.ConstantTime.Integers.m z == FStar.ConstantTime.Integers.m x +% FStar.ConstantTime.Integers.m y }
Prims.Tot
[ "total" ]
[]
[ "FStar.IFC.sl", "FStar.IFC.lattice_element", "FStar.Integers.signed_width", "Prims.l_and", "Prims.b2t", "FStar.Integers.uu___is_Unsigned", "Prims.op_disEquality", "FStar.Integers.width", "FStar.Integers.width_of_sw", "FStar.Integers.W128", "FStar.ConstantTime.Integers.secret_int", "FStar.IFC.op_let_Greater_Greater", "FStar.Integers.int_t", "FStar.IFC.lub", "Prims.eq2", "FStar.IFC.reveal", "FStar.IFC.return", "FStar.Integers.op_Plus_Percent", "FStar.IFC.protected", "FStar.ConstantTime.Integers.m" ]
[]
false
false
false
false
false
let addition_mod (#sl: sl) (#l: lattice_element sl) (#sw: _{Unsigned? sw /\ width_of_sw sw <> W128}) (x y: secret_int l sw) : Tot (z: secret_int l sw {m z == m x +% m y}) =
let>> a = x in let>> b = y in return l (a +% b)
false
FStar.ConstantTime.Integers.fst
FStar.ConstantTime.Integers.addition
val addition (#sl:sl) (#l:lattice_element sl) (#s:sw) (x : secret_int l s) (y : secret_int l s {ok ( + ) (m x) (m y)}) : Tot (z:secret_int l s{m z == m x + m y})
val addition (#sl:sl) (#l:lattice_element sl) (#s:sw) (x : secret_int l s) (y : secret_int l s {ok ( + ) (m x) (m y)}) : Tot (z:secret_int l s{m z == m x + m y})
let addition #sl (#l:lattice_element sl) #s (x : secret_int l s) (y : secret_int l s {ok ( + ) (m x) (m y)}) : Tot (z:secret_int l s{m z == m x + m y}) = let>> a = x in let>> b = y in return l (a + b)
{ "file_name": "ulib/experimental/FStar.ConstantTime.Integers.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 22, "end_line": 72, "start_col": 0, "start_line": 66 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.ConstantTime.Integers (** This module provides a refinement of FStar.IFC providing an interface restricted only to constant-time operations on integers. In contrast, FStar.IFC provides a general monadic information-flow control framework, which need not be restricted to constant-time operations. *) open FStar.IFC open FStar.Integers /// A `secret_int l s` is a machine-integer at secrecy level `l` and /// signedness/width `s`. let secret_int (#sl:sl) (l:lattice_element sl) (s:sw) : Type0 = protected l (int_t s) /// A `secret_int l s` can be seen as an int in spec let reveal (#sl:sl) (#l:lattice_element sl) (#s:sw) (x:secret_int l s) : GTot (y:int{within_bounds s y}) = v (reveal x) /// `hide` is the inverse of `reveal`, proving that `secret_int` is injective let hide (#sl:sl) (#l:lattice_element sl) (#s:sw) (x:int{within_bounds s x}) : GTot (secret_int l s) = return l (u x) let reveal_hide #sl #l #s x = () let hide_reveal #sl #l #s x = () let promote #sl #l0 #s x l1 = join (return #_ #(secret_int l0 s) l1 x) ////////////////////////////////////////////////////////////////////////////////////////// /// The remainder of this module provides liftings of specific integers operations /// to work on secret integers, i.e., only those that respect the constant time guarantees /// and do not break confidentiality. /// /// Note, with our choice of representation, it is impossible to /// implement functions that break basic IFC guarantees, e.g., we /// cannot implement a boolean comparison function on secret_ints noextract
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Integers.fst.checked", "FStar.IFC.fsti.checked" ], "interface_file": true, "source_file": "FStar.ConstantTime.Integers.fst" }
[ { "abbrev": false, "full_module": "FStar.Integers", "short_module": null }, { "abbrev": false, "full_module": "FStar.IFC", "short_module": null }, { "abbrev": false, "full_module": "FStar.ConstantTime", "short_module": null }, { "abbrev": false, "full_module": "FStar.ConstantTime", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: FStar.ConstantTime.Integers.secret_int l s -> y: FStar.ConstantTime.Integers.secret_int l s { FStar.Integers.ok FStar.Integers.op_Plus (FStar.ConstantTime.Integers.m x) (FStar.ConstantTime.Integers.m y) } -> z: FStar.ConstantTime.Integers.secret_int l s { FStar.ConstantTime.Integers.m z == FStar.ConstantTime.Integers.m x + FStar.ConstantTime.Integers.m y }
Prims.Tot
[ "total" ]
[]
[ "FStar.IFC.sl", "FStar.IFC.lattice_element", "FStar.ConstantTime.Integers.sw", "FStar.ConstantTime.Integers.secret_int", "FStar.Integers.ok", "FStar.Integers.op_Plus", "FStar.Integers.Signed", "FStar.Integers.Winfinite", "FStar.ConstantTime.Integers.m", "FStar.IFC.op_let_Greater_Greater", "FStar.Integers.int_t", "FStar.IFC.lub", "Prims.eq2", "FStar.IFC.reveal", "FStar.IFC.return", "FStar.IFC.protected" ]
[]
false
false
false
false
false
let addition #sl (#l: lattice_element sl) #s (x: secret_int l s) (y: secret_int l s {ok ( + ) (m x) (m y)}) : Tot (z: secret_int l s {m z == m x + m y}) =
let>> a = x in let>> b = y in return l (a + b)
false
Hacl.Bignum.Base.fst
Hacl.Bignum.Base.mul_wide_add2_st
val mul_wide_add2_st: #t:limb_t -> mul_wide_add2_t t
val mul_wide_add2_st: #t:limb_t -> mul_wide_add2_t t
let mul_wide_add2_st #t = match t with | U32 -> mul_wide_add2_u32 | U64 -> mul_wide_add2_u64
{ "file_name": "code/bignum/Hacl.Bignum.Base.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 28, "end_line": 131, "start_col": 0, "start_line": 128 }
module Hacl.Bignum.Base open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer open Hacl.Bignum.Definitions include Hacl.Spec.Bignum.Base module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** unsigned char _addcarry_u64 (unsigned char c_in, unsigned __int64 a, unsigned __int64 b, unsigned __int64 * out) Description Add unsigned 64-bit integers a and b with unsigned 8-bit carry-in c_in (carry flag), and store the unsigned 64-bit result in out, and the carry-out in dst (carry or overflow flag). *) inline_for_extraction noextract val addcarry_st: #t:limb_t -> c_in:carry t -> a:limb t -> b:limb t -> out:lbuffer (limb t) 1ul -> Stack (carry t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == addcarry c_in a b) let addcarry_st #t c_in a b out = Lib.IntTypes.Intrinsics.add_carry c_in a b out (** unsigned char _subborrow_u64 (unsigned char b_in, unsigned __int64 a, unsigned __int64 b, unsigned __int64 * out) Description Add unsigned 8-bit borrow b_in (carry flag) to unsigned 64-bit integer b, and subtract the result from unsigned 64-bit integer a. Store the unsigned 64-bit result in out, and the carry-out in dst (carry or overflow flag). *) inline_for_extraction noextract val subborrow_st: #t:limb_t -> c_in:carry t -> a:limb t -> b:limb t -> out:lbuffer (limb t) 1ul -> Stack (carry t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == subborrow c_in a b) let subborrow_st c_in a b out = Lib.IntTypes.Intrinsics.sub_borrow c_in a b out inline_for_extraction noextract let mul_wide_add_t (t:limb_t) = a:limb t -> b:limb t -> c_in:limb t -> out:lbuffer (limb t) 1ul -> Stack (limb t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == mul_wide_add a b c_in) val mul_wide_add_u32: mul_wide_add_t U32 [@CInline] let mul_wide_add_u32 a b c_in out = lemma_mul_wide_add a b c_in (u32 0); let res = to_u64 a *! to_u64 b +! to_u64 c_in in out.(0ul) <- to_u32 res; to_u32 (res >>. 32ul) val mul_wide_add_u64: mul_wide_add_t U64 [@CInline] let mul_wide_add_u64 a b c_in out = lemma_mul_wide_add a b c_in (u64 0); let res = mul64_wide a b +! to_u128 c_in in out.(0ul) <- to_u64 res; to_u64 (res >>. 64ul) inline_for_extraction noextract val mul_wide_add_st: #t:limb_t -> mul_wide_add_t t let mul_wide_add_st #t = match t with | U32 -> mul_wide_add_u32 | U64 -> mul_wide_add_u64 inline_for_extraction noextract let mul_wide_add2_t (t:limb_t) = a:limb t -> b:limb t -> c_in:limb t -> out:lbuffer (limb t) 1ul -> Stack (limb t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == mul_wide_add2 a b c_in (LSeq.index (as_seq h0 out) 0)) val mul_wide_add2_u32: mul_wide_add2_t U32 [@CInline] let mul_wide_add2_u32 a b c_in out = let out0 = out.(0ul) in lemma_mul_wide_add a b c_in out0; let res = to_u64 a *! to_u64 b +! to_u64 c_in +! to_u64 out0 in out.(0ul) <- to_u32 res; to_u32 (res >>. 32ul) val mul_wide_add2_u64: mul_wide_add2_t U64 [@CInline] let mul_wide_add2_u64 a b c_in out = let out0 = out.(0ul) in lemma_mul_wide_add a b c_in out0; let res = mul64_wide a b +! to_u128 c_in +! to_u128 out0 in out.(0ul) <- to_u64 res; to_u64 (res >>. 64ul) inline_for_extraction noextract
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.Intrinsics.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.Bignum.Base.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Bignum.Base.fst" }
[ { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum.Base", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Bignum.Base.mul_wide_add2_t t
Prims.Tot
[ "total" ]
[]
[ "Hacl.Bignum.Definitions.limb_t", "Hacl.Bignum.Base.mul_wide_add2_u32", "Hacl.Bignum.Base.mul_wide_add2_u64", "Hacl.Bignum.Base.mul_wide_add2_t" ]
[]
false
false
false
false
false
let mul_wide_add2_st #t =
match t with | U32 -> mul_wide_add2_u32 | U64 -> mul_wide_add2_u64
false
Hacl.Bignum.Base.fst
Hacl.Bignum.Base.mul_wide_add_st
val mul_wide_add_st: #t:limb_t -> mul_wide_add_t t
val mul_wide_add_st: #t:limb_t -> mul_wide_add_t t
let mul_wide_add_st #t = match t with | U32 -> mul_wide_add_u32 | U64 -> mul_wide_add_u64
{ "file_name": "code/bignum/Hacl.Bignum.Base.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 27, "end_line": 91, "start_col": 0, "start_line": 88 }
module Hacl.Bignum.Base open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer open Hacl.Bignum.Definitions include Hacl.Spec.Bignum.Base module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** unsigned char _addcarry_u64 (unsigned char c_in, unsigned __int64 a, unsigned __int64 b, unsigned __int64 * out) Description Add unsigned 64-bit integers a and b with unsigned 8-bit carry-in c_in (carry flag), and store the unsigned 64-bit result in out, and the carry-out in dst (carry or overflow flag). *) inline_for_extraction noextract val addcarry_st: #t:limb_t -> c_in:carry t -> a:limb t -> b:limb t -> out:lbuffer (limb t) 1ul -> Stack (carry t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == addcarry c_in a b) let addcarry_st #t c_in a b out = Lib.IntTypes.Intrinsics.add_carry c_in a b out (** unsigned char _subborrow_u64 (unsigned char b_in, unsigned __int64 a, unsigned __int64 b, unsigned __int64 * out) Description Add unsigned 8-bit borrow b_in (carry flag) to unsigned 64-bit integer b, and subtract the result from unsigned 64-bit integer a. Store the unsigned 64-bit result in out, and the carry-out in dst (carry or overflow flag). *) inline_for_extraction noextract val subborrow_st: #t:limb_t -> c_in:carry t -> a:limb t -> b:limb t -> out:lbuffer (limb t) 1ul -> Stack (carry t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == subborrow c_in a b) let subborrow_st c_in a b out = Lib.IntTypes.Intrinsics.sub_borrow c_in a b out inline_for_extraction noextract let mul_wide_add_t (t:limb_t) = a:limb t -> b:limb t -> c_in:limb t -> out:lbuffer (limb t) 1ul -> Stack (limb t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == mul_wide_add a b c_in) val mul_wide_add_u32: mul_wide_add_t U32 [@CInline] let mul_wide_add_u32 a b c_in out = lemma_mul_wide_add a b c_in (u32 0); let res = to_u64 a *! to_u64 b +! to_u64 c_in in out.(0ul) <- to_u32 res; to_u32 (res >>. 32ul) val mul_wide_add_u64: mul_wide_add_t U64 [@CInline] let mul_wide_add_u64 a b c_in out = lemma_mul_wide_add a b c_in (u64 0); let res = mul64_wide a b +! to_u128 c_in in out.(0ul) <- to_u64 res; to_u64 (res >>. 64ul) inline_for_extraction noextract
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.Intrinsics.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.Bignum.Base.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Bignum.Base.fst" }
[ { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum.Base", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Bignum.Base.mul_wide_add_t t
Prims.Tot
[ "total" ]
[]
[ "Hacl.Bignum.Definitions.limb_t", "Hacl.Bignum.Base.mul_wide_add_u32", "Hacl.Bignum.Base.mul_wide_add_u64", "Hacl.Bignum.Base.mul_wide_add_t" ]
[]
false
false
false
false
false
let mul_wide_add_st #t =
match t with | U32 -> mul_wide_add_u32 | U64 -> mul_wide_add_u64
false
Hacl.Bignum.Base.fst
Hacl.Bignum.Base.mul_wide_add_t
val mul_wide_add_t : t: Hacl.Bignum.Definitions.limb_t -> Type0
let mul_wide_add_t (t:limb_t) = a:limb t -> b:limb t -> c_in:limb t -> out:lbuffer (limb t) 1ul -> Stack (limb t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == mul_wide_add a b c_in)
{ "file_name": "code/bignum/Hacl.Bignum.Base.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 67, "end_line": 65, "start_col": 0, "start_line": 57 }
module Hacl.Bignum.Base open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer open Hacl.Bignum.Definitions include Hacl.Spec.Bignum.Base module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** unsigned char _addcarry_u64 (unsigned char c_in, unsigned __int64 a, unsigned __int64 b, unsigned __int64 * out) Description Add unsigned 64-bit integers a and b with unsigned 8-bit carry-in c_in (carry flag), and store the unsigned 64-bit result in out, and the carry-out in dst (carry or overflow flag). *) inline_for_extraction noextract val addcarry_st: #t:limb_t -> c_in:carry t -> a:limb t -> b:limb t -> out:lbuffer (limb t) 1ul -> Stack (carry t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == addcarry c_in a b) let addcarry_st #t c_in a b out = Lib.IntTypes.Intrinsics.add_carry c_in a b out (** unsigned char _subborrow_u64 (unsigned char b_in, unsigned __int64 a, unsigned __int64 b, unsigned __int64 * out) Description Add unsigned 8-bit borrow b_in (carry flag) to unsigned 64-bit integer b, and subtract the result from unsigned 64-bit integer a. Store the unsigned 64-bit result in out, and the carry-out in dst (carry or overflow flag). *) inline_for_extraction noextract val subborrow_st: #t:limb_t -> c_in:carry t -> a:limb t -> b:limb t -> out:lbuffer (limb t) 1ul -> Stack (carry t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == subborrow c_in a b) let subborrow_st c_in a b out = Lib.IntTypes.Intrinsics.sub_borrow c_in a b out
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.Intrinsics.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.Bignum.Base.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Bignum.Base.fst" }
[ { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum.Base", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
t: Hacl.Bignum.Definitions.limb_t -> Type0
Prims.Tot
[ "total" ]
[]
[ "Hacl.Bignum.Definitions.limb_t", "Hacl.Bignum.Definitions.limb", "Lib.Buffer.lbuffer", "FStar.UInt32.__uint_to_t", "FStar.Monotonic.HyperStack.mem", "Lib.Buffer.live", "Lib.Buffer.MUT", "Prims.l_and", "Lib.Buffer.modifies", "Lib.Buffer.loc", "Prims.eq2", "FStar.Pervasives.Native.tuple2", "Hacl.Spec.Bignum.Definitions.limb", "FStar.Pervasives.Native.Mktuple2", "Lib.Sequence.index", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Lib.Buffer.as_seq", "Hacl.Spec.Bignum.Base.mul_wide_add" ]
[]
false
false
false
true
true
let mul_wide_add_t (t: limb_t) =
a: limb t -> b: limb t -> c_in: limb t -> out: lbuffer (limb t) 1ul -> Stack (limb t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == mul_wide_add a b c_in )
false
Hacl.Bignum.Base.fst
Hacl.Bignum.Base.mul_wide_add_u32
val mul_wide_add_u32: mul_wide_add_t U32
val mul_wide_add_u32: mul_wide_add_t U32
let mul_wide_add_u32 a b c_in out = lemma_mul_wide_add a b c_in (u32 0); let res = to_u64 a *! to_u64 b +! to_u64 c_in in out.(0ul) <- to_u32 res; to_u32 (res >>. 32ul)
{ "file_name": "code/bignum/Hacl.Bignum.Base.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 23, "end_line": 74, "start_col": 0, "start_line": 70 }
module Hacl.Bignum.Base open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer open Hacl.Bignum.Definitions include Hacl.Spec.Bignum.Base module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** unsigned char _addcarry_u64 (unsigned char c_in, unsigned __int64 a, unsigned __int64 b, unsigned __int64 * out) Description Add unsigned 64-bit integers a and b with unsigned 8-bit carry-in c_in (carry flag), and store the unsigned 64-bit result in out, and the carry-out in dst (carry or overflow flag). *) inline_for_extraction noextract val addcarry_st: #t:limb_t -> c_in:carry t -> a:limb t -> b:limb t -> out:lbuffer (limb t) 1ul -> Stack (carry t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == addcarry c_in a b) let addcarry_st #t c_in a b out = Lib.IntTypes.Intrinsics.add_carry c_in a b out (** unsigned char _subborrow_u64 (unsigned char b_in, unsigned __int64 a, unsigned __int64 b, unsigned __int64 * out) Description Add unsigned 8-bit borrow b_in (carry flag) to unsigned 64-bit integer b, and subtract the result from unsigned 64-bit integer a. Store the unsigned 64-bit result in out, and the carry-out in dst (carry or overflow flag). *) inline_for_extraction noextract val subborrow_st: #t:limb_t -> c_in:carry t -> a:limb t -> b:limb t -> out:lbuffer (limb t) 1ul -> Stack (carry t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == subborrow c_in a b) let subborrow_st c_in a b out = Lib.IntTypes.Intrinsics.sub_borrow c_in a b out inline_for_extraction noextract let mul_wide_add_t (t:limb_t) = a:limb t -> b:limb t -> c_in:limb t -> out:lbuffer (limb t) 1ul -> Stack (limb t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == mul_wide_add a b c_in) val mul_wide_add_u32: mul_wide_add_t U32
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.Intrinsics.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.Bignum.Base.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Bignum.Base.fst" }
[ { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum.Base", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Bignum.Base.mul_wide_add_t Lib.IntTypes.U32
Prims.Tot
[ "total" ]
[]
[ "Hacl.Bignum.Definitions.limb", "Lib.IntTypes.U32", "Lib.Buffer.lbuffer", "FStar.UInt32.__uint_to_t", "Lib.IntTypes.to_u32", "Lib.IntTypes.U64", "Lib.IntTypes.SEC", "Lib.IntTypes.op_Greater_Greater_Dot", "Prims.unit", "Lib.Buffer.op_Array_Assignment", "Lib.IntTypes.int_t", "Lib.IntTypes.op_Plus_Bang", "Lib.IntTypes.op_Star_Bang", "Lib.IntTypes.to_u64", "Hacl.Spec.Bignum.Base.lemma_mul_wide_add", "Lib.IntTypes.u32" ]
[]
false
false
false
true
false
let mul_wide_add_u32 a b c_in out =
lemma_mul_wide_add a b c_in (u32 0); let res = to_u64 a *! to_u64 b +! to_u64 c_in in out.(0ul) <- to_u32 res; to_u32 (res >>. 32ul)
false
Hacl.Bignum.Base.fst
Hacl.Bignum.Base.mul_wide_add2_t
val mul_wide_add2_t : t: Hacl.Bignum.Definitions.limb_t -> Type0
let mul_wide_add2_t (t:limb_t) = a:limb t -> b:limb t -> c_in:limb t -> out:lbuffer (limb t) 1ul -> Stack (limb t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == mul_wide_add2 a b c_in (LSeq.index (as_seq h0 out) 0))
{ "file_name": "code/bignum/Hacl.Bignum.Base.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 99, "end_line": 103, "start_col": 0, "start_line": 95 }
module Hacl.Bignum.Base open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer open Hacl.Bignum.Definitions include Hacl.Spec.Bignum.Base module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** unsigned char _addcarry_u64 (unsigned char c_in, unsigned __int64 a, unsigned __int64 b, unsigned __int64 * out) Description Add unsigned 64-bit integers a and b with unsigned 8-bit carry-in c_in (carry flag), and store the unsigned 64-bit result in out, and the carry-out in dst (carry or overflow flag). *) inline_for_extraction noextract val addcarry_st: #t:limb_t -> c_in:carry t -> a:limb t -> b:limb t -> out:lbuffer (limb t) 1ul -> Stack (carry t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == addcarry c_in a b) let addcarry_st #t c_in a b out = Lib.IntTypes.Intrinsics.add_carry c_in a b out (** unsigned char _subborrow_u64 (unsigned char b_in, unsigned __int64 a, unsigned __int64 b, unsigned __int64 * out) Description Add unsigned 8-bit borrow b_in (carry flag) to unsigned 64-bit integer b, and subtract the result from unsigned 64-bit integer a. Store the unsigned 64-bit result in out, and the carry-out in dst (carry or overflow flag). *) inline_for_extraction noextract val subborrow_st: #t:limb_t -> c_in:carry t -> a:limb t -> b:limb t -> out:lbuffer (limb t) 1ul -> Stack (carry t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == subborrow c_in a b) let subborrow_st c_in a b out = Lib.IntTypes.Intrinsics.sub_borrow c_in a b out inline_for_extraction noextract let mul_wide_add_t (t:limb_t) = a:limb t -> b:limb t -> c_in:limb t -> out:lbuffer (limb t) 1ul -> Stack (limb t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == mul_wide_add a b c_in) val mul_wide_add_u32: mul_wide_add_t U32 [@CInline] let mul_wide_add_u32 a b c_in out = lemma_mul_wide_add a b c_in (u32 0); let res = to_u64 a *! to_u64 b +! to_u64 c_in in out.(0ul) <- to_u32 res; to_u32 (res >>. 32ul) val mul_wide_add_u64: mul_wide_add_t U64 [@CInline] let mul_wide_add_u64 a b c_in out = lemma_mul_wide_add a b c_in (u64 0); let res = mul64_wide a b +! to_u128 c_in in out.(0ul) <- to_u64 res; to_u64 (res >>. 64ul) inline_for_extraction noextract val mul_wide_add_st: #t:limb_t -> mul_wide_add_t t let mul_wide_add_st #t = match t with | U32 -> mul_wide_add_u32 | U64 -> mul_wide_add_u64
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.Intrinsics.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.Bignum.Base.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Bignum.Base.fst" }
[ { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum.Base", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
t: Hacl.Bignum.Definitions.limb_t -> Type0
Prims.Tot
[ "total" ]
[]
[ "Hacl.Bignum.Definitions.limb_t", "Hacl.Bignum.Definitions.limb", "Lib.Buffer.lbuffer", "FStar.UInt32.__uint_to_t", "FStar.Monotonic.HyperStack.mem", "Lib.Buffer.live", "Lib.Buffer.MUT", "Prims.l_and", "Lib.Buffer.modifies", "Lib.Buffer.loc", "Prims.eq2", "FStar.Pervasives.Native.tuple2", "Hacl.Spec.Bignum.Definitions.limb", "FStar.Pervasives.Native.Mktuple2", "Lib.Sequence.index", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Lib.Buffer.as_seq", "Hacl.Spec.Bignum.Base.mul_wide_add2" ]
[]
false
false
false
true
true
let mul_wide_add2_t (t: limb_t) =
a: limb t -> b: limb t -> c_in: limb t -> out: lbuffer (limb t) 1ul -> Stack (limb t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == mul_wide_add2 a b c_in (LSeq.index (as_seq h0 out) 0))
false
Hacl.Bignum.Base.fst
Hacl.Bignum.Base.mul_wide_add2_u32
val mul_wide_add2_u32: mul_wide_add2_t U32
val mul_wide_add2_u32: mul_wide_add2_t U32
let mul_wide_add2_u32 a b c_in out = let out0 = out.(0ul) in lemma_mul_wide_add a b c_in out0; let res = to_u64 a *! to_u64 b +! to_u64 c_in +! to_u64 out0 in out.(0ul) <- to_u32 res; to_u32 (res >>. 32ul)
{ "file_name": "code/bignum/Hacl.Bignum.Base.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 23, "end_line": 113, "start_col": 0, "start_line": 108 }
module Hacl.Bignum.Base open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer open Hacl.Bignum.Definitions include Hacl.Spec.Bignum.Base module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** unsigned char _addcarry_u64 (unsigned char c_in, unsigned __int64 a, unsigned __int64 b, unsigned __int64 * out) Description Add unsigned 64-bit integers a and b with unsigned 8-bit carry-in c_in (carry flag), and store the unsigned 64-bit result in out, and the carry-out in dst (carry or overflow flag). *) inline_for_extraction noextract val addcarry_st: #t:limb_t -> c_in:carry t -> a:limb t -> b:limb t -> out:lbuffer (limb t) 1ul -> Stack (carry t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == addcarry c_in a b) let addcarry_st #t c_in a b out = Lib.IntTypes.Intrinsics.add_carry c_in a b out (** unsigned char _subborrow_u64 (unsigned char b_in, unsigned __int64 a, unsigned __int64 b, unsigned __int64 * out) Description Add unsigned 8-bit borrow b_in (carry flag) to unsigned 64-bit integer b, and subtract the result from unsigned 64-bit integer a. Store the unsigned 64-bit result in out, and the carry-out in dst (carry or overflow flag). *) inline_for_extraction noextract val subborrow_st: #t:limb_t -> c_in:carry t -> a:limb t -> b:limb t -> out:lbuffer (limb t) 1ul -> Stack (carry t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == subborrow c_in a b) let subborrow_st c_in a b out = Lib.IntTypes.Intrinsics.sub_borrow c_in a b out inline_for_extraction noextract let mul_wide_add_t (t:limb_t) = a:limb t -> b:limb t -> c_in:limb t -> out:lbuffer (limb t) 1ul -> Stack (limb t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == mul_wide_add a b c_in) val mul_wide_add_u32: mul_wide_add_t U32 [@CInline] let mul_wide_add_u32 a b c_in out = lemma_mul_wide_add a b c_in (u32 0); let res = to_u64 a *! to_u64 b +! to_u64 c_in in out.(0ul) <- to_u32 res; to_u32 (res >>. 32ul) val mul_wide_add_u64: mul_wide_add_t U64 [@CInline] let mul_wide_add_u64 a b c_in out = lemma_mul_wide_add a b c_in (u64 0); let res = mul64_wide a b +! to_u128 c_in in out.(0ul) <- to_u64 res; to_u64 (res >>. 64ul) inline_for_extraction noextract val mul_wide_add_st: #t:limb_t -> mul_wide_add_t t let mul_wide_add_st #t = match t with | U32 -> mul_wide_add_u32 | U64 -> mul_wide_add_u64 inline_for_extraction noextract let mul_wide_add2_t (t:limb_t) = a:limb t -> b:limb t -> c_in:limb t -> out:lbuffer (limb t) 1ul -> Stack (limb t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == mul_wide_add2 a b c_in (LSeq.index (as_seq h0 out) 0)) val mul_wide_add2_u32: mul_wide_add2_t U32
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.Intrinsics.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.Bignum.Base.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Bignum.Base.fst" }
[ { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum.Base", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Bignum.Base.mul_wide_add2_t Lib.IntTypes.U32
Prims.Tot
[ "total" ]
[]
[ "Hacl.Bignum.Definitions.limb", "Lib.IntTypes.U32", "Lib.Buffer.lbuffer", "FStar.UInt32.__uint_to_t", "Lib.IntTypes.to_u32", "Lib.IntTypes.U64", "Lib.IntTypes.SEC", "Lib.IntTypes.op_Greater_Greater_Dot", "Prims.unit", "Lib.Buffer.op_Array_Assignment", "Lib.IntTypes.int_t", "Lib.IntTypes.op_Plus_Bang", "Lib.IntTypes.op_Star_Bang", "Lib.IntTypes.to_u64", "Hacl.Spec.Bignum.Base.lemma_mul_wide_add", "Lib.Buffer.op_Array_Access", "Lib.Buffer.MUT" ]
[]
false
false
false
true
false
let mul_wide_add2_u32 a b c_in out =
let out0 = out.(0ul) in lemma_mul_wide_add a b c_in out0; let res = to_u64 a *! to_u64 b +! to_u64 c_in +! to_u64 out0 in out.(0ul) <- to_u32 res; to_u32 (res >>. 32ul)
false
Hacl.Bignum.Base.fst
Hacl.Bignum.Base.mul_wide_add2_u64
val mul_wide_add2_u64: mul_wide_add2_t U64
val mul_wide_add2_u64: mul_wide_add2_t U64
let mul_wide_add2_u64 a b c_in out = let out0 = out.(0ul) in lemma_mul_wide_add a b c_in out0; let res = mul64_wide a b +! to_u128 c_in +! to_u128 out0 in out.(0ul) <- to_u64 res; to_u64 (res >>. 64ul)
{ "file_name": "code/bignum/Hacl.Bignum.Base.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 23, "end_line": 123, "start_col": 0, "start_line": 118 }
module Hacl.Bignum.Base open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer open Hacl.Bignum.Definitions include Hacl.Spec.Bignum.Base module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** unsigned char _addcarry_u64 (unsigned char c_in, unsigned __int64 a, unsigned __int64 b, unsigned __int64 * out) Description Add unsigned 64-bit integers a and b with unsigned 8-bit carry-in c_in (carry flag), and store the unsigned 64-bit result in out, and the carry-out in dst (carry or overflow flag). *) inline_for_extraction noextract val addcarry_st: #t:limb_t -> c_in:carry t -> a:limb t -> b:limb t -> out:lbuffer (limb t) 1ul -> Stack (carry t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == addcarry c_in a b) let addcarry_st #t c_in a b out = Lib.IntTypes.Intrinsics.add_carry c_in a b out (** unsigned char _subborrow_u64 (unsigned char b_in, unsigned __int64 a, unsigned __int64 b, unsigned __int64 * out) Description Add unsigned 8-bit borrow b_in (carry flag) to unsigned 64-bit integer b, and subtract the result from unsigned 64-bit integer a. Store the unsigned 64-bit result in out, and the carry-out in dst (carry or overflow flag). *) inline_for_extraction noextract val subborrow_st: #t:limb_t -> c_in:carry t -> a:limb t -> b:limb t -> out:lbuffer (limb t) 1ul -> Stack (carry t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == subborrow c_in a b) let subborrow_st c_in a b out = Lib.IntTypes.Intrinsics.sub_borrow c_in a b out inline_for_extraction noextract let mul_wide_add_t (t:limb_t) = a:limb t -> b:limb t -> c_in:limb t -> out:lbuffer (limb t) 1ul -> Stack (limb t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == mul_wide_add a b c_in) val mul_wide_add_u32: mul_wide_add_t U32 [@CInline] let mul_wide_add_u32 a b c_in out = lemma_mul_wide_add a b c_in (u32 0); let res = to_u64 a *! to_u64 b +! to_u64 c_in in out.(0ul) <- to_u32 res; to_u32 (res >>. 32ul) val mul_wide_add_u64: mul_wide_add_t U64 [@CInline] let mul_wide_add_u64 a b c_in out = lemma_mul_wide_add a b c_in (u64 0); let res = mul64_wide a b +! to_u128 c_in in out.(0ul) <- to_u64 res; to_u64 (res >>. 64ul) inline_for_extraction noextract val mul_wide_add_st: #t:limb_t -> mul_wide_add_t t let mul_wide_add_st #t = match t with | U32 -> mul_wide_add_u32 | U64 -> mul_wide_add_u64 inline_for_extraction noextract let mul_wide_add2_t (t:limb_t) = a:limb t -> b:limb t -> c_in:limb t -> out:lbuffer (limb t) 1ul -> Stack (limb t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == mul_wide_add2 a b c_in (LSeq.index (as_seq h0 out) 0)) val mul_wide_add2_u32: mul_wide_add2_t U32 [@CInline] let mul_wide_add2_u32 a b c_in out = let out0 = out.(0ul) in lemma_mul_wide_add a b c_in out0; let res = to_u64 a *! to_u64 b +! to_u64 c_in +! to_u64 out0 in out.(0ul) <- to_u32 res; to_u32 (res >>. 32ul) val mul_wide_add2_u64: mul_wide_add2_t U64
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.Intrinsics.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.Bignum.Base.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Bignum.Base.fst" }
[ { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum.Base", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Bignum.Base.mul_wide_add2_t Lib.IntTypes.U64
Prims.Tot
[ "total" ]
[]
[ "Hacl.Bignum.Definitions.limb", "Lib.IntTypes.U64", "Lib.Buffer.lbuffer", "FStar.UInt32.__uint_to_t", "Lib.IntTypes.to_u64", "Lib.IntTypes.U128", "Lib.IntTypes.SEC", "Lib.IntTypes.op_Greater_Greater_Dot", "Prims.unit", "Lib.Buffer.op_Array_Assignment", "Lib.IntTypes.int_t", "Lib.IntTypes.op_Plus_Bang", "Lib.IntTypes.mul64_wide", "Lib.IntTypes.to_u128", "Hacl.Spec.Bignum.Base.lemma_mul_wide_add", "Lib.Buffer.op_Array_Access", "Lib.Buffer.MUT" ]
[]
false
false
false
true
false
let mul_wide_add2_u64 a b c_in out =
let out0 = out.(0ul) in lemma_mul_wide_add a b c_in out0; let res = mul64_wide a b +! to_u128 c_in +! to_u128 out0 in out.(0ul) <- to_u64 res; to_u64 (res >>. 64ul)
false
Hacl.Bignum.Base.fst
Hacl.Bignum.Base.mul_wide_add_u64
val mul_wide_add_u64: mul_wide_add_t U64
val mul_wide_add_u64: mul_wide_add_t U64
let mul_wide_add_u64 a b c_in out = lemma_mul_wide_add a b c_in (u64 0); let res = mul64_wide a b +! to_u128 c_in in out.(0ul) <- to_u64 res; to_u64 (res >>. 64ul)
{ "file_name": "code/bignum/Hacl.Bignum.Base.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 23, "end_line": 83, "start_col": 0, "start_line": 79 }
module Hacl.Bignum.Base open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer open Hacl.Bignum.Definitions include Hacl.Spec.Bignum.Base module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** unsigned char _addcarry_u64 (unsigned char c_in, unsigned __int64 a, unsigned __int64 b, unsigned __int64 * out) Description Add unsigned 64-bit integers a and b with unsigned 8-bit carry-in c_in (carry flag), and store the unsigned 64-bit result in out, and the carry-out in dst (carry or overflow flag). *) inline_for_extraction noextract val addcarry_st: #t:limb_t -> c_in:carry t -> a:limb t -> b:limb t -> out:lbuffer (limb t) 1ul -> Stack (carry t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == addcarry c_in a b) let addcarry_st #t c_in a b out = Lib.IntTypes.Intrinsics.add_carry c_in a b out (** unsigned char _subborrow_u64 (unsigned char b_in, unsigned __int64 a, unsigned __int64 b, unsigned __int64 * out) Description Add unsigned 8-bit borrow b_in (carry flag) to unsigned 64-bit integer b, and subtract the result from unsigned 64-bit integer a. Store the unsigned 64-bit result in out, and the carry-out in dst (carry or overflow flag). *) inline_for_extraction noextract val subborrow_st: #t:limb_t -> c_in:carry t -> a:limb t -> b:limb t -> out:lbuffer (limb t) 1ul -> Stack (carry t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == subborrow c_in a b) let subborrow_st c_in a b out = Lib.IntTypes.Intrinsics.sub_borrow c_in a b out inline_for_extraction noextract let mul_wide_add_t (t:limb_t) = a:limb t -> b:limb t -> c_in:limb t -> out:lbuffer (limb t) 1ul -> Stack (limb t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == mul_wide_add a b c_in) val mul_wide_add_u32: mul_wide_add_t U32 [@CInline] let mul_wide_add_u32 a b c_in out = lemma_mul_wide_add a b c_in (u32 0); let res = to_u64 a *! to_u64 b +! to_u64 c_in in out.(0ul) <- to_u32 res; to_u32 (res >>. 32ul) val mul_wide_add_u64: mul_wide_add_t U64
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.Intrinsics.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.Bignum.Base.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Bignum.Base.fst" }
[ { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum.Base", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Hacl.Bignum.Base.mul_wide_add_t Lib.IntTypes.U64
Prims.Tot
[ "total" ]
[]
[ "Hacl.Bignum.Definitions.limb", "Lib.IntTypes.U64", "Lib.Buffer.lbuffer", "FStar.UInt32.__uint_to_t", "Lib.IntTypes.to_u64", "Lib.IntTypes.U128", "Lib.IntTypes.SEC", "Lib.IntTypes.op_Greater_Greater_Dot", "Prims.unit", "Lib.Buffer.op_Array_Assignment", "Lib.IntTypes.int_t", "Lib.IntTypes.op_Plus_Bang", "Lib.IntTypes.mul64_wide", "Lib.IntTypes.to_u128", "Hacl.Spec.Bignum.Base.lemma_mul_wide_add", "Lib.IntTypes.u64" ]
[]
false
false
false
true
false
let mul_wide_add_u64 a b c_in out =
lemma_mul_wide_add a b c_in (u64 0); let res = mul64_wide a b +! to_u128 c_in in out.(0ul) <- to_u64 res; to_u64 (res >>. 64ul)
false
Hacl.Bignum.Base.fst
Hacl.Bignum.Base.subborrow_st
val subborrow_st: #t:limb_t -> c_in:carry t -> a:limb t -> b:limb t -> out:lbuffer (limb t) 1ul -> Stack (carry t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == subborrow c_in a b)
val subborrow_st: #t:limb_t -> c_in:carry t -> a:limb t -> b:limb t -> out:lbuffer (limb t) 1ul -> Stack (carry t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == subborrow c_in a b)
let subborrow_st c_in a b out = Lib.IntTypes.Intrinsics.sub_borrow c_in a b out
{ "file_name": "code/bignum/Hacl.Bignum.Base.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 49, "end_line": 53, "start_col": 0, "start_line": 52 }
module Hacl.Bignum.Base open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer open Hacl.Bignum.Definitions include Hacl.Spec.Bignum.Base module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** unsigned char _addcarry_u64 (unsigned char c_in, unsigned __int64 a, unsigned __int64 b, unsigned __int64 * out) Description Add unsigned 64-bit integers a and b with unsigned 8-bit carry-in c_in (carry flag), and store the unsigned 64-bit result in out, and the carry-out in dst (carry or overflow flag). *) inline_for_extraction noextract val addcarry_st: #t:limb_t -> c_in:carry t -> a:limb t -> b:limb t -> out:lbuffer (limb t) 1ul -> Stack (carry t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == addcarry c_in a b) let addcarry_st #t c_in a b out = Lib.IntTypes.Intrinsics.add_carry c_in a b out (** unsigned char _subborrow_u64 (unsigned char b_in, unsigned __int64 a, unsigned __int64 b, unsigned __int64 * out) Description Add unsigned 8-bit borrow b_in (carry flag) to unsigned 64-bit integer b, and subtract the result from unsigned 64-bit integer a. Store the unsigned 64-bit result in out, and the carry-out in dst (carry or overflow flag). *) inline_for_extraction noextract val subborrow_st: #t:limb_t -> c_in:carry t -> a:limb t -> b:limb t -> out:lbuffer (limb t) 1ul -> Stack (carry t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == subborrow c_in a b)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.Intrinsics.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.Bignum.Base.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Bignum.Base.fst" }
[ { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum.Base", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
c_in: Hacl.Spec.Bignum.Base.carry t -> a: Hacl.Bignum.Definitions.limb t -> b: Hacl.Bignum.Definitions.limb t -> out: Lib.Buffer.lbuffer (Hacl.Bignum.Definitions.limb t) 1ul -> FStar.HyperStack.ST.Stack (Hacl.Spec.Bignum.Base.carry t)
FStar.HyperStack.ST.Stack
[]
[]
[ "Hacl.Bignum.Definitions.limb_t", "Hacl.Spec.Bignum.Base.carry", "Hacl.Bignum.Definitions.limb", "Lib.Buffer.lbuffer", "FStar.UInt32.__uint_to_t", "Lib.IntTypes.Intrinsics.sub_borrow", "Lib.IntTypes.uint_t", "Lib.IntTypes.SEC" ]
[]
false
true
false
false
false
let subborrow_st c_in a b out =
Lib.IntTypes.Intrinsics.sub_borrow c_in a b out
false
Hacl.Bignum.Base.fst
Hacl.Bignum.Base.addcarry_st
val addcarry_st: #t:limb_t -> c_in:carry t -> a:limb t -> b:limb t -> out:lbuffer (limb t) 1ul -> Stack (carry t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == addcarry c_in a b)
val addcarry_st: #t:limb_t -> c_in:carry t -> a:limb t -> b:limb t -> out:lbuffer (limb t) 1ul -> Stack (carry t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == addcarry c_in a b)
let addcarry_st #t c_in a b out = Lib.IntTypes.Intrinsics.add_carry c_in a b out
{ "file_name": "code/bignum/Hacl.Bignum.Base.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 48, "end_line": 35, "start_col": 0, "start_line": 34 }
module Hacl.Bignum.Base open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Lib.IntTypes open Lib.Buffer open Hacl.Bignum.Definitions include Hacl.Spec.Bignum.Base module ST = FStar.HyperStack.ST module LSeq = Lib.Sequence #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" (** unsigned char _addcarry_u64 (unsigned char c_in, unsigned __int64 a, unsigned __int64 b, unsigned __int64 * out) Description Add unsigned 64-bit integers a and b with unsigned 8-bit carry-in c_in (carry flag), and store the unsigned 64-bit result in out, and the carry-out in dst (carry or overflow flag). *) inline_for_extraction noextract val addcarry_st: #t:limb_t -> c_in:carry t -> a:limb t -> b:limb t -> out:lbuffer (limb t) 1ul -> Stack (carry t) (requires fun h -> live h out) (ensures fun h0 c_out h1 -> modifies (loc out) h0 h1 /\ (c_out, LSeq.index (as_seq h1 out) 0) == addcarry c_in a b)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.Intrinsics.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.Bignum.Base.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Bignum.Base.fst" }
[ { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum.Base", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
c_in: Hacl.Spec.Bignum.Base.carry t -> a: Hacl.Bignum.Definitions.limb t -> b: Hacl.Bignum.Definitions.limb t -> out: Lib.Buffer.lbuffer (Hacl.Bignum.Definitions.limb t) 1ul -> FStar.HyperStack.ST.Stack (Hacl.Spec.Bignum.Base.carry t)
FStar.HyperStack.ST.Stack
[]
[]
[ "Hacl.Bignum.Definitions.limb_t", "Hacl.Spec.Bignum.Base.carry", "Hacl.Bignum.Definitions.limb", "Lib.Buffer.lbuffer", "FStar.UInt32.__uint_to_t", "Lib.IntTypes.Intrinsics.add_carry", "Lib.IntTypes.uint_t", "Lib.IntTypes.SEC" ]
[]
false
true
false
false
false
let addcarry_st #t c_in a b out =
Lib.IntTypes.Intrinsics.add_carry c_in a b out
false
FStar.IndefiniteDescription.fst
FStar.IndefiniteDescription.elim_squash
val elim_squash (#p:Type u#a) (s:squash p) : GTot p
val elim_squash (#p:Type u#a) (s:squash p) : GTot p
let elim_squash (#p:Type u#a) (s:squash p) : GTot p = let uu : squash (x:p & squash trivial) = bind_squash s (fun x -> return_squash (| x, return_squash T |)) in give_proof (return_squash uu); indefinite_description_ghost p (fun _ -> squash trivial)
{ "file_name": "ulib/FStar.IndefiniteDescription.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 58, "end_line": 89, "start_col": 0, "start_line": 85 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.IndefiniteDescription /// Indefinite description is an axiom that allows picking a witness /// for existentially quantified predicate. See the interface for more /// context. /// open FStar.Classical open FStar.Squash (** The main axiom: Given a classical proof of [exists x. p x], we can exhibit an erased (computationally irrelevant) a witness [x:erased a] validating [p x]. *) irreducible let indefinite_description_tot (a:Type) (p:(a -> prop) { exists x. p x }) : Tot (w:Ghost.erased a{ p w }) = admit() //this is an axiom (** A version in ghost is easily derivable *) let indefinite_description_ghost (a: Type) (p: (a -> prop) { exists x. p x }) : GTot (x: a { p x }) = let w = indefinite_description_tot a p in let x = Ghost.reveal w in x (** Indefinite description entails the a strong form of the excluded middle, i.e., one can case-analyze the truth of a proposition (only in [Ghost]) *) let strong_excluded_middle (p: Type0) : GTot (b: bool{b = true <==> p}) = let aux (p: Type0) : Lemma (exists b. b = true <==> p) = give_proof (bind_squash (get_proof (l_or p (~p))) (fun (b: l_or p (~p)) -> bind_squash b (fun (b': Prims.sum p (~p)) -> match b' with | Prims.Left hp -> give_witness hp; exists_intro (fun b -> b = true <==> p) true; get_proof (exists b. b = true <==> p) | Prims.Right hnp -> give_witness hnp; exists_intro (fun b -> b = true <==> p) false; get_proof (exists b. b = true <==> p)))) in aux p; indefinite_description_ghost bool (fun b -> b = true <==> p) (** We also can combine this with a the classical tautology converting with a [forall] and an [exists] to extract a witness of validity of [p] from a classical proof that [p] is not universally invalid. Note, F*+SMT can easily prove, since it is just classical logic: [(~(forall n. ~(p n))) ==> (exists n. p n) ] *) let stronger_markovs_principle (p: (nat -> GTot bool)) : Ghost nat (requires (~(forall (n: nat). ~(p n)))) (ensures (fun n -> p n)) = indefinite_description_ghost _ (fun n -> p n==true) (** A variant of the previous lemma, but for a [prop] rather than a boolean predicate *) let stronger_markovs_principle_prop (p: (nat -> GTot prop)) : Ghost nat (requires (~(forall (n: nat). ~(p n)))) (ensures (fun n -> p n)) = indefinite_description_ghost _ p (** A proof for squash p can be eliminated to get p in the Ghost effect *)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Squash.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "FStar.IndefiniteDescription.fst" }
[ { "abbrev": false, "full_module": "FStar.Squash", "short_module": null }, { "abbrev": false, "full_module": "FStar.Classical", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
s: Prims.squash p -> Prims.GTot p
Prims.GTot
[ "sometrivial" ]
[]
[ "Prims.squash", "FStar.IndefiniteDescription.indefinite_description_ghost", "Prims.trivial", "Prims.prop", "Prims.unit", "FStar.Squash.give_proof", "Prims.dtuple2", "FStar.Squash.return_squash", "FStar.Squash.bind_squash", "Prims.Mkdtuple2", "Prims.T" ]
[]
false
false
false
false
false
let elim_squash (#p: Type u#a) (s: squash p) : GTot p =
let uu:squash (x: p & squash trivial) = bind_squash s (fun x -> return_squash (| x, return_squash T |)) in give_proof (return_squash uu); indefinite_description_ghost p (fun _ -> squash trivial)
false
FStar.IndefiniteDescription.fst
FStar.IndefiniteDescription.strong_excluded_middle
val strong_excluded_middle (p: Type0) : GTot (b: bool{b = true <==> p})
val strong_excluded_middle (p: Type0) : GTot (b: bool{b = true <==> p})
let strong_excluded_middle (p: Type0) : GTot (b: bool{b = true <==> p}) = let aux (p: Type0) : Lemma (exists b. b = true <==> p) = give_proof (bind_squash (get_proof (l_or p (~p))) (fun (b: l_or p (~p)) -> bind_squash b (fun (b': Prims.sum p (~p)) -> match b' with | Prims.Left hp -> give_witness hp; exists_intro (fun b -> b = true <==> p) true; get_proof (exists b. b = true <==> p) | Prims.Right hnp -> give_witness hnp; exists_intro (fun b -> b = true <==> p) false; get_proof (exists b. b = true <==> p)))) in aux p; indefinite_description_ghost bool (fun b -> b = true <==> p)
{ "file_name": "ulib/FStar.IndefiniteDescription.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 62, "end_line": 64, "start_col": 0, "start_line": 47 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.IndefiniteDescription /// Indefinite description is an axiom that allows picking a witness /// for existentially quantified predicate. See the interface for more /// context. /// open FStar.Classical open FStar.Squash (** The main axiom: Given a classical proof of [exists x. p x], we can exhibit an erased (computationally irrelevant) a witness [x:erased a] validating [p x]. *) irreducible let indefinite_description_tot (a:Type) (p:(a -> prop) { exists x. p x }) : Tot (w:Ghost.erased a{ p w }) = admit() //this is an axiom (** A version in ghost is easily derivable *) let indefinite_description_ghost (a: Type) (p: (a -> prop) { exists x. p x }) : GTot (x: a { p x }) = let w = indefinite_description_tot a p in let x = Ghost.reveal w in x (** Indefinite description entails the a strong form of the excluded middle, i.e., one can case-analyze the truth of a proposition
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Squash.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "FStar.IndefiniteDescription.fst" }
[ { "abbrev": false, "full_module": "FStar.Squash", "short_module": null }, { "abbrev": false, "full_module": "FStar.Classical", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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: Type0 -> Prims.GTot (b: Prims.bool{b = true <==> p})
Prims.GTot
[ "sometrivial" ]
[]
[ "FStar.IndefiniteDescription.indefinite_description_ghost", "Prims.bool", "Prims.l_iff", "Prims.b2t", "Prims.op_Equality", "Prims.prop", "Prims.unit", "Prims.l_True", "Prims.squash", "Prims.l_Exists", "Prims.Nil", "FStar.Pervasives.pattern", "FStar.Squash.give_proof", "FStar.Squash.bind_squash", "Prims.l_or", "Prims.l_not", "FStar.Squash.get_proof", "Prims.sum", "FStar.Classical.exists_intro", "FStar.Classical.give_witness" ]
[]
false
false
false
false
false
let strong_excluded_middle (p: Type0) : GTot (b: bool{b = true <==> p}) =
let aux (p: Type0) : Lemma (exists b. b = true <==> p) = give_proof (bind_squash (get_proof (l_or p (~p))) (fun (b: l_or p (~p)) -> bind_squash b (fun (b': Prims.sum p (~p)) -> match b' with | Prims.Left hp -> give_witness hp; exists_intro (fun b -> b = true <==> p) true; get_proof (exists b. b = true <==> p) | Prims.Right hnp -> give_witness hnp; exists_intro (fun b -> b = true <==> p) false; get_proof (exists b. b = true <==> p)))) in aux p; indefinite_description_ghost bool (fun b -> b = true <==> p)
false
FStar.IndefiniteDescription.fst
FStar.IndefiniteDescription.stronger_markovs_principle_prop
val stronger_markovs_principle_prop (p: (nat -> GTot prop)) : Ghost nat (requires (~(forall (n: nat). ~(p n)))) (ensures (fun n -> p n))
val stronger_markovs_principle_prop (p: (nat -> GTot prop)) : Ghost nat (requires (~(forall (n: nat). ~(p n)))) (ensures (fun n -> p n))
let stronger_markovs_principle_prop (p: (nat -> GTot prop)) : Ghost nat (requires (~(forall (n: nat). ~(p n)))) (ensures (fun n -> p n)) = indefinite_description_ghost _ p
{ "file_name": "ulib/FStar.IndefiniteDescription.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 36, "end_line": 80, "start_col": 0, "start_line": 78 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.IndefiniteDescription /// Indefinite description is an axiom that allows picking a witness /// for existentially quantified predicate. See the interface for more /// context. /// open FStar.Classical open FStar.Squash (** The main axiom: Given a classical proof of [exists x. p x], we can exhibit an erased (computationally irrelevant) a witness [x:erased a] validating [p x]. *) irreducible let indefinite_description_tot (a:Type) (p:(a -> prop) { exists x. p x }) : Tot (w:Ghost.erased a{ p w }) = admit() //this is an axiom (** A version in ghost is easily derivable *) let indefinite_description_ghost (a: Type) (p: (a -> prop) { exists x. p x }) : GTot (x: a { p x }) = let w = indefinite_description_tot a p in let x = Ghost.reveal w in x (** Indefinite description entails the a strong form of the excluded middle, i.e., one can case-analyze the truth of a proposition (only in [Ghost]) *) let strong_excluded_middle (p: Type0) : GTot (b: bool{b = true <==> p}) = let aux (p: Type0) : Lemma (exists b. b = true <==> p) = give_proof (bind_squash (get_proof (l_or p (~p))) (fun (b: l_or p (~p)) -> bind_squash b (fun (b': Prims.sum p (~p)) -> match b' with | Prims.Left hp -> give_witness hp; exists_intro (fun b -> b = true <==> p) true; get_proof (exists b. b = true <==> p) | Prims.Right hnp -> give_witness hnp; exists_intro (fun b -> b = true <==> p) false; get_proof (exists b. b = true <==> p)))) in aux p; indefinite_description_ghost bool (fun b -> b = true <==> p) (** We also can combine this with a the classical tautology converting with a [forall] and an [exists] to extract a witness of validity of [p] from a classical proof that [p] is not universally invalid. Note, F*+SMT can easily prove, since it is just classical logic: [(~(forall n. ~(p n))) ==> (exists n. p n) ] *) let stronger_markovs_principle (p: (nat -> GTot bool)) : Ghost nat (requires (~(forall (n: nat). ~(p n)))) (ensures (fun n -> p n)) = indefinite_description_ghost _ (fun n -> p n==true) (** A variant of the previous lemma, but for a [prop] rather than a
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Squash.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "FStar.IndefiniteDescription.fst" }
[ { "abbrev": false, "full_module": "FStar.Squash", "short_module": null }, { "abbrev": false, "full_module": "FStar.Classical", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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.nat -> Prims.GTot Prims.prop) -> Prims.Ghost Prims.nat
Prims.Ghost
[]
[]
[ "Prims.nat", "Prims.prop", "FStar.IndefiniteDescription.indefinite_description_ghost", "Prims.l_not", "Prims.l_Forall" ]
[]
false
false
false
false
false
let stronger_markovs_principle_prop (p: (nat -> GTot prop)) : Ghost nat (requires (~(forall (n: nat). ~(p n)))) (ensures (fun n -> p n)) =
indefinite_description_ghost _ p
false
FStar.IndefiniteDescription.fst
FStar.IndefiniteDescription.indefinite_description_ghost
val indefinite_description_ghost (a: Type) (p: (a -> prop) { exists x. p x }) : GTot (x: a { p x })
val indefinite_description_ghost (a: Type) (p: (a -> prop) { exists x. p x }) : GTot (x: a { p x })
let indefinite_description_ghost (a: Type) (p: (a -> prop) { exists x. p x }) : GTot (x: a { p x }) = let w = indefinite_description_tot a p in let x = Ghost.reveal w in x
{ "file_name": "ulib/FStar.IndefiniteDescription.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 5, "end_line": 42, "start_col": 0, "start_line": 38 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.IndefiniteDescription /// Indefinite description is an axiom that allows picking a witness /// for existentially quantified predicate. See the interface for more /// context. /// open FStar.Classical open FStar.Squash (** The main axiom: Given a classical proof of [exists x. p x], we can exhibit an erased (computationally irrelevant) a witness [x:erased a] validating [p x]. *) irreducible let indefinite_description_tot (a:Type) (p:(a -> prop) { exists x. p x }) : Tot (w:Ghost.erased a{ p w }) = admit() //this is an axiom
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Squash.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "FStar.IndefiniteDescription.fst" }
[ { "abbrev": false, "full_module": "FStar.Squash", "short_module": null }, { "abbrev": false, "full_module": "FStar.Classical", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type -> p: (_: a -> Prims.prop){exists (x: a). p x} -> Prims.GTot (x: a{p x})
Prims.GTot
[ "sometrivial" ]
[]
[ "Prims.prop", "Prims.l_Exists", "FStar.Ghost.reveal", "FStar.Ghost.erased", "FStar.IndefiniteDescription.indefinite_description_tot" ]
[]
false
false
false
false
false
let indefinite_description_ghost (a: Type) (p: (a -> prop){exists x. p x}) : GTot (x: a{p x}) =
let w = indefinite_description_tot a p in let x = Ghost.reveal w in x
false
FStar.IndefiniteDescription.fst
FStar.IndefiniteDescription.stronger_markovs_principle
val stronger_markovs_principle (p: (nat -> GTot bool)) : Ghost nat (requires (~(forall (n: nat). ~(p n)))) (ensures (fun n -> p n))
val stronger_markovs_principle (p: (nat -> GTot bool)) : Ghost nat (requires (~(forall (n: nat). ~(p n)))) (ensures (fun n -> p n))
let stronger_markovs_principle (p: (nat -> GTot bool)) : Ghost nat (requires (~(forall (n: nat). ~(p n)))) (ensures (fun n -> p n)) = indefinite_description_ghost _ (fun n -> p n==true)
{ "file_name": "ulib/FStar.IndefiniteDescription.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 55, "end_line": 74, "start_col": 0, "start_line": 72 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.IndefiniteDescription /// Indefinite description is an axiom that allows picking a witness /// for existentially quantified predicate. See the interface for more /// context. /// open FStar.Classical open FStar.Squash (** The main axiom: Given a classical proof of [exists x. p x], we can exhibit an erased (computationally irrelevant) a witness [x:erased a] validating [p x]. *) irreducible let indefinite_description_tot (a:Type) (p:(a -> prop) { exists x. p x }) : Tot (w:Ghost.erased a{ p w }) = admit() //this is an axiom (** A version in ghost is easily derivable *) let indefinite_description_ghost (a: Type) (p: (a -> prop) { exists x. p x }) : GTot (x: a { p x }) = let w = indefinite_description_tot a p in let x = Ghost.reveal w in x (** Indefinite description entails the a strong form of the excluded middle, i.e., one can case-analyze the truth of a proposition (only in [Ghost]) *) let strong_excluded_middle (p: Type0) : GTot (b: bool{b = true <==> p}) = let aux (p: Type0) : Lemma (exists b. b = true <==> p) = give_proof (bind_squash (get_proof (l_or p (~p))) (fun (b: l_or p (~p)) -> bind_squash b (fun (b': Prims.sum p (~p)) -> match b' with | Prims.Left hp -> give_witness hp; exists_intro (fun b -> b = true <==> p) true; get_proof (exists b. b = true <==> p) | Prims.Right hnp -> give_witness hnp; exists_intro (fun b -> b = true <==> p) false; get_proof (exists b. b = true <==> p)))) in aux p; indefinite_description_ghost bool (fun b -> b = true <==> p) (** We also can combine this with a the classical tautology converting with a [forall] and an [exists] to extract a witness of validity of [p] from a classical proof that [p] is not universally invalid. Note, F*+SMT can easily prove, since it is just classical logic:
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Squash.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "FStar.IndefiniteDescription.fst" }
[ { "abbrev": false, "full_module": "FStar.Squash", "short_module": null }, { "abbrev": false, "full_module": "FStar.Classical", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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.nat -> Prims.GTot Prims.bool) -> Prims.Ghost Prims.nat
Prims.Ghost
[]
[]
[ "Prims.nat", "Prims.bool", "FStar.IndefiniteDescription.indefinite_description_ghost", "Prims.eq2", "Prims.prop", "Prims.l_not", "Prims.l_Forall", "Prims.b2t" ]
[]
false
false
false
false
false
let stronger_markovs_principle (p: (nat -> GTot bool)) : Ghost nat (requires (~(forall (n: nat). ~(p n)))) (ensures (fun n -> p n)) =
indefinite_description_ghost _ (fun n -> p n == true)
false
Lib.NatMod.fsti
Lib.NatMod.nat_mod
val nat_mod : m: Prims.pos -> Type0
let nat_mod (m:pos) = n:nat{n < m}
{ "file_name": "lib/Lib.NatMod.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 34, "end_line": 51, "start_col": 0, "start_line": 51 }
module Lib.NatMod open FStar.Mul module Fermat = FStar.Math.Fermat module Euclid = FStar.Math.Euclid module LE = Lib.Exponentiation.Definition #set-options "--z3rlimit 10 --fuel 0 --ifuel 0" let mk_nat_comm_monoid : LE.comm_monoid int = { LE.one = 1; LE.mul = FStar.Mul.op_Star; LE.lemma_one = Math.Lemmas.mul_one_right_is_same; LE.lemma_mul_assoc = Math.Lemmas.paren_mul_right; LE.lemma_mul_comm = Math.Lemmas.swap_mul; } let rec pow (x:int) (n:nat) : Tot int = if n = 0 then 1 else x * pow x (n - 1) val lemma_pow0: a:int -> Lemma (pow a 0 = 1) val lemma_pow1: a:int -> Lemma (pow a 1 = a) val lemma_pow_unfold: a:int -> b:pos -> Lemma (a * pow a (b - 1) == pow a b) val lemma_pow_gt_zero: a:pos -> b:nat -> Lemma (pow a b > 0) [SMTPat (pow a b)] val lemma_pow_ge_zero: a:nat -> b:nat -> Lemma (pow a b >= 0) [SMTPat (pow a b)] val lemma_pow_nat_is_pow: a:int -> b:nat -> Lemma (pow a b == LE.pow mk_nat_comm_monoid a b) val lemma_pow_zero: b:pos -> Lemma (pow 0 b = 0) val lemma_pow_one: b:nat -> Lemma (pow 1 b = 1) val lemma_pow_add: x:int -> n:nat -> m:nat -> Lemma (pow x n * pow x m = pow x (n + m)) val lemma_pow_mul: x:int -> n:nat -> m:nat -> Lemma (pow (pow x n) m = pow x (n * m)) val lemma_pow_double: a:int -> b:nat -> Lemma (pow (a * a) b == pow a (b + b)) val lemma_pow_mul_base: a:int -> b:int -> n:nat -> Lemma (pow a n * pow b n == pow (a * b) n) val lemma_pow_mod_base: a:int -> b:nat -> n:pos -> Lemma (pow a b % n == pow (a % n) b % n)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Exponentiation.Definition.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Math.Fermat.fsti.checked", "FStar.Math.Euclid.fsti.checked" ], "interface_file": false, "source_file": "Lib.NatMod.fsti" }
[ { "abbrev": true, "full_module": "Lib.Exponentiation.Definition", "short_module": "LE" }, { "abbrev": true, "full_module": "FStar.Math.Euclid", "short_module": "Euclid" }, { "abbrev": true, "full_module": "FStar.Math.Fermat", "short_module": "Fermat" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "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": 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": 10, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
m: Prims.pos -> Type0
Prims.Tot
[ "total" ]
[]
[ "Prims.pos", "Prims.nat", "Prims.b2t", "Prims.op_LessThan" ]
[]
false
false
false
true
true
let nat_mod (m: pos) =
n: nat{n < m}
false
Vale.Def.Opaque_s.fst
Vale.Def.Opaque_s.opaque_make
val opaque_make (#a:Type) (x:a) : a
val opaque_make (#a:Type) (x:a) : a
let opaque_make #a x = x
{ "file_name": "vale/specs/defs/Vale.Def.Opaque_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 24, "end_line": 4, "start_col": 0, "start_line": 4 }
module Vale.Def.Opaque_s open FStar.Mul
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Vale.Def.Opaque_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": 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
x: a -> a
Prims.Tot
[ "total" ]
[]
[]
[]
false
false
false
true
false
let opaque_make #a x =
x
false
Lib.NatMod.fsti
Lib.NatMod.mk_nat_mod_comm_monoid
val mk_nat_mod_comm_monoid (m: pos) : LE.comm_monoid (nat_mod m)
val mk_nat_mod_comm_monoid (m: pos) : LE.comm_monoid (nat_mod m)
let mk_nat_mod_comm_monoid (m:pos) : LE.comm_monoid (nat_mod m) = { LE.one = one_mod; LE.mul = mul_mod; LE.lemma_one = lemma_mul_mod_one; LE.lemma_mul_assoc = lemma_mul_mod_assoc; LE.lemma_mul_comm = lemma_mul_mod_comm; }
{ "file_name": "lib/Lib.NatMod.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 3, "end_line": 72, "start_col": 0, "start_line": 66 }
module Lib.NatMod open FStar.Mul module Fermat = FStar.Math.Fermat module Euclid = FStar.Math.Euclid module LE = Lib.Exponentiation.Definition #set-options "--z3rlimit 10 --fuel 0 --ifuel 0" let mk_nat_comm_monoid : LE.comm_monoid int = { LE.one = 1; LE.mul = FStar.Mul.op_Star; LE.lemma_one = Math.Lemmas.mul_one_right_is_same; LE.lemma_mul_assoc = Math.Lemmas.paren_mul_right; LE.lemma_mul_comm = Math.Lemmas.swap_mul; } let rec pow (x:int) (n:nat) : Tot int = if n = 0 then 1 else x * pow x (n - 1) val lemma_pow0: a:int -> Lemma (pow a 0 = 1) val lemma_pow1: a:int -> Lemma (pow a 1 = a) val lemma_pow_unfold: a:int -> b:pos -> Lemma (a * pow a (b - 1) == pow a b) val lemma_pow_gt_zero: a:pos -> b:nat -> Lemma (pow a b > 0) [SMTPat (pow a b)] val lemma_pow_ge_zero: a:nat -> b:nat -> Lemma (pow a b >= 0) [SMTPat (pow a b)] val lemma_pow_nat_is_pow: a:int -> b:nat -> Lemma (pow a b == LE.pow mk_nat_comm_monoid a b) val lemma_pow_zero: b:pos -> Lemma (pow 0 b = 0) val lemma_pow_one: b:nat -> Lemma (pow 1 b = 1) val lemma_pow_add: x:int -> n:nat -> m:nat -> Lemma (pow x n * pow x m = pow x (n + m)) val lemma_pow_mul: x:int -> n:nat -> m:nat -> Lemma (pow (pow x n) m = pow x (n * m)) val lemma_pow_double: a:int -> b:nat -> Lemma (pow (a * a) b == pow a (b + b)) val lemma_pow_mul_base: a:int -> b:int -> n:nat -> Lemma (pow a n * pow b n == pow (a * b) n) val lemma_pow_mod_base: a:int -> b:nat -> n:pos -> Lemma (pow a b % n == pow (a % n) b % n) let nat_mod (m:pos) = n:nat{n < m} let one_mod (#m:pos) : nat_mod m = 1 % m let mul_mod (#m:pos) (a:nat_mod m) (b:nat_mod m) : nat_mod m = a * b % m let add_mod (#m:pos) (a:nat_mod m) (b:nat_mod m) : nat_mod m = (a + b) % m let sub_mod (#m:pos) (a:nat_mod m) (b:nat_mod m) : nat_mod m = (a - b) % m val lemma_mul_mod_one: #m:pos -> a:nat_mod m -> Lemma (mul_mod a one_mod == a) val lemma_mul_mod_assoc: #m:pos -> a:nat_mod m -> b:nat_mod m -> c:nat_mod m -> Lemma (mul_mod (mul_mod a b) c == mul_mod a (mul_mod b c)) val lemma_mul_mod_comm: #m:pos -> a:nat_mod m -> b:nat_mod m -> Lemma (mul_mod a b == mul_mod b a)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Exponentiation.Definition.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Math.Fermat.fsti.checked", "FStar.Math.Euclid.fsti.checked" ], "interface_file": false, "source_file": "Lib.NatMod.fsti" }
[ { "abbrev": true, "full_module": "Lib.Exponentiation.Definition", "short_module": "LE" }, { "abbrev": true, "full_module": "FStar.Math.Euclid", "short_module": "Euclid" }, { "abbrev": true, "full_module": "FStar.Math.Fermat", "short_module": "Fermat" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "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": 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": 10, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
m: Prims.pos -> Lib.Exponentiation.Definition.comm_monoid (Lib.NatMod.nat_mod m)
Prims.Tot
[ "total" ]
[]
[ "Prims.pos", "Lib.Exponentiation.Definition.Mkcomm_monoid", "Lib.NatMod.nat_mod", "Lib.NatMod.one_mod", "Lib.NatMod.mul_mod", "Lib.NatMod.lemma_mul_mod_one", "Lib.NatMod.lemma_mul_mod_assoc", "Lib.NatMod.lemma_mul_mod_comm", "Lib.Exponentiation.Definition.comm_monoid" ]
[]
false
false
false
false
false
let mk_nat_mod_comm_monoid (m: pos) : LE.comm_monoid (nat_mod m) =
{ LE.one = one_mod; LE.mul = mul_mod; LE.lemma_one = lemma_mul_mod_one; LE.lemma_mul_assoc = lemma_mul_mod_assoc; LE.lemma_mul_comm = lemma_mul_mod_comm }
false
Vale.Def.Opaque_s.fst
Vale.Def.Opaque_s.opaque_reveal
val opaque_reveal (#a:Type) (s:string) (x1 x2:a) : Lemma (requires norm [delta_only [s]] (x1 == opaque_make x2)) (ensures x1 == x2)
val opaque_reveal (#a:Type) (s:string) (x1 x2:a) : Lemma (requires norm [delta_only [s]] (x1 == opaque_make x2)) (ensures x1 == x2)
let opaque_reveal #a s x1 x2 = norm_spec [delta_only [s]] (x1 == opaque_make x2)
{ "file_name": "vale/specs/defs/Vale.Def.Opaque_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 51, "end_line": 7, "start_col": 0, "start_line": 6 }
module Vale.Def.Opaque_s open FStar.Mul let opaque_make #a x = x
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Vale.Def.Opaque_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": 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
s: Prims.string -> x1: a -> x2: a -> FStar.Pervasives.Lemma (requires FStar.Pervasives.norm [FStar.Pervasives.delta_only [s]] (x1 == Vale.Def.Opaque_s.opaque_make x2)) (ensures x1 == x2)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.string", "FStar.Pervasives.norm_spec", "Prims.Cons", "FStar.Pervasives.norm_step", "FStar.Pervasives.delta_only", "Prims.Nil", "Prims.logical", "Prims.eq2", "Vale.Def.Opaque_s.opaque_make", "Prims.unit" ]
[]
true
false
true
false
false
let opaque_reveal #a s x1 x2 =
norm_spec [delta_only [s]] (x1 == opaque_make x2)
false
Lib.NatMod.fsti
Lib.NatMod.prime
val prime : Type0
let prime = m:pos{1 < m /\ Euclid.is_prime m}
{ "file_name": "lib/Lib.NatMod.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 45, "end_line": 113, "start_col": 0, "start_line": 113 }
module Lib.NatMod open FStar.Mul module Fermat = FStar.Math.Fermat module Euclid = FStar.Math.Euclid module LE = Lib.Exponentiation.Definition #set-options "--z3rlimit 10 --fuel 0 --ifuel 0" let mk_nat_comm_monoid : LE.comm_monoid int = { LE.one = 1; LE.mul = FStar.Mul.op_Star; LE.lemma_one = Math.Lemmas.mul_one_right_is_same; LE.lemma_mul_assoc = Math.Lemmas.paren_mul_right; LE.lemma_mul_comm = Math.Lemmas.swap_mul; } let rec pow (x:int) (n:nat) : Tot int = if n = 0 then 1 else x * pow x (n - 1) val lemma_pow0: a:int -> Lemma (pow a 0 = 1) val lemma_pow1: a:int -> Lemma (pow a 1 = a) val lemma_pow_unfold: a:int -> b:pos -> Lemma (a * pow a (b - 1) == pow a b) val lemma_pow_gt_zero: a:pos -> b:nat -> Lemma (pow a b > 0) [SMTPat (pow a b)] val lemma_pow_ge_zero: a:nat -> b:nat -> Lemma (pow a b >= 0) [SMTPat (pow a b)] val lemma_pow_nat_is_pow: a:int -> b:nat -> Lemma (pow a b == LE.pow mk_nat_comm_monoid a b) val lemma_pow_zero: b:pos -> Lemma (pow 0 b = 0) val lemma_pow_one: b:nat -> Lemma (pow 1 b = 1) val lemma_pow_add: x:int -> n:nat -> m:nat -> Lemma (pow x n * pow x m = pow x (n + m)) val lemma_pow_mul: x:int -> n:nat -> m:nat -> Lemma (pow (pow x n) m = pow x (n * m)) val lemma_pow_double: a:int -> b:nat -> Lemma (pow (a * a) b == pow a (b + b)) val lemma_pow_mul_base: a:int -> b:int -> n:nat -> Lemma (pow a n * pow b n == pow (a * b) n) val lemma_pow_mod_base: a:int -> b:nat -> n:pos -> Lemma (pow a b % n == pow (a % n) b % n) let nat_mod (m:pos) = n:nat{n < m} let one_mod (#m:pos) : nat_mod m = 1 % m let mul_mod (#m:pos) (a:nat_mod m) (b:nat_mod m) : nat_mod m = a * b % m let add_mod (#m:pos) (a:nat_mod m) (b:nat_mod m) : nat_mod m = (a + b) % m let sub_mod (#m:pos) (a:nat_mod m) (b:nat_mod m) : nat_mod m = (a - b) % m val lemma_mul_mod_one: #m:pos -> a:nat_mod m -> Lemma (mul_mod a one_mod == a) val lemma_mul_mod_assoc: #m:pos -> a:nat_mod m -> b:nat_mod m -> c:nat_mod m -> Lemma (mul_mod (mul_mod a b) c == mul_mod a (mul_mod b c)) val lemma_mul_mod_comm: #m:pos -> a:nat_mod m -> b:nat_mod m -> Lemma (mul_mod a b == mul_mod b a) let mk_nat_mod_comm_monoid (m:pos) : LE.comm_monoid (nat_mod m) = { LE.one = one_mod; LE.mul = mul_mod; LE.lemma_one = lemma_mul_mod_one; LE.lemma_mul_assoc = lemma_mul_mod_assoc; LE.lemma_mul_comm = lemma_mul_mod_comm; } inline_for_extraction let rec pow_mod_ (#m:pos{1 < m}) (a:nat_mod m) (b:nat) : Tot (nat_mod m) (decreases b) = if b = 0 then 1 else if b % 2 = 0 then pow_mod_ (mul_mod a a) (b / 2) else mul_mod a (pow_mod_ (mul_mod a a) (b / 2)) val pow_mod: #m:pos{1 < m} -> a:nat_mod m -> b:nat -> nat_mod m val pow_mod_def: #m:pos{1 < m} -> a:nat_mod m -> b:nat -> Lemma (pow_mod a b == pow_mod_ a b) val lemma_pow_mod: #m:pos{1 < m} -> a:nat_mod m -> b:nat -> Lemma (pow a b % m == pow_mod #m a b) val lemma_pow_nat_mod_is_pow: #n:pos{1 < n} -> a:nat_mod n -> b:nat -> Lemma (pow a b % n == LE.pow (mk_nat_mod_comm_monoid n) a b) val lemma_add_mod_one: #m:pos -> a:nat_mod m -> Lemma (add_mod a 0 == a) val lemma_add_mod_assoc: #m:pos -> a:nat_mod m -> b:nat_mod m -> c:nat_mod m -> Lemma (add_mod (add_mod a b) c == add_mod a (add_mod b c)) val lemma_add_mod_comm: #m:pos -> a:nat_mod m -> b:nat_mod m -> Lemma (add_mod a b == add_mod b a) val lemma_mod_distributivity_add_right: #m:pos -> a:nat_mod m -> b:nat_mod m -> c:nat_mod m -> Lemma (mul_mod a (add_mod b c) == add_mod (mul_mod a b) (mul_mod a c)) val lemma_mod_distributivity_add_left: #m:pos -> a:nat_mod m -> b:nat_mod m -> c:nat_mod m -> Lemma (mul_mod (add_mod a b) c == add_mod (mul_mod a c) (mul_mod b c)) val lemma_mod_distributivity_sub_right: #m:pos -> a:nat_mod m -> b:nat_mod m -> c:nat_mod m -> Lemma (mul_mod a (sub_mod b c) == sub_mod (mul_mod a b) (mul_mod a c)) val lemma_mod_distributivity_sub_left: #m:pos -> a:nat_mod m -> b:nat_mod m -> c:nat_mod m -> Lemma (mul_mod (sub_mod a b) c == sub_mod (mul_mod a c) (mul_mod b c))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Exponentiation.Definition.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Math.Fermat.fsti.checked", "FStar.Math.Euclid.fsti.checked" ], "interface_file": false, "source_file": "Lib.NatMod.fsti" }
[ { "abbrev": true, "full_module": "Lib.Exponentiation.Definition", "short_module": "LE" }, { "abbrev": true, "full_module": "FStar.Math.Euclid", "short_module": "Euclid" }, { "abbrev": true, "full_module": "FStar.Math.Fermat", "short_module": "Fermat" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "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": 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": 10, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Type0
Prims.Tot
[ "total" ]
[]
[ "Prims.pos", "Prims.l_and", "Prims.b2t", "Prims.op_LessThan", "FStar.Math.Euclid.is_prime" ]
[]
false
false
false
true
true
let prime =
m: pos{1 < m /\ Euclid.is_prime m}
false
Vale.Def.Opaque_s.fst
Vale.Def.Opaque_s.opaque_revealer
val opaque_revealer (#a:Type) (s:string) (x1 x2:a) : Pure (unit -> Lemma (x1 == x2)) (requires norm [delta_only [s]] (x1 == opaque_make x2)) (ensures fun _ -> True)
val opaque_revealer (#a:Type) (s:string) (x1 x2:a) : Pure (unit -> Lemma (x1 == x2)) (requires norm [delta_only [s]] (x1 == opaque_make x2)) (ensures fun _ -> True)
let opaque_revealer #a s x1 x2 = fun () -> opaque_reveal s x1 x2
{ "file_name": "vale/specs/defs/Vale.Def.Opaque_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 33, "end_line": 13, "start_col": 0, "start_line": 12 }
module Vale.Def.Opaque_s open FStar.Mul let opaque_make #a x = x let opaque_reveal #a s x1 x2 = norm_spec [delta_only [s]] (x1 == opaque_make x2) let opaque_assert #a s x1 x2 p = norm_spec [delta_only [s]] (x1 == opaque_make x2)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Vale.Def.Opaque_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": 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
s: Prims.string -> x1: a -> x2: a -> Prims.Pure (_: Prims.unit -> FStar.Pervasives.Lemma (ensures x1 == x2))
Prims.Pure
[]
[]
[ "Prims.string", "Prims.unit", "Vale.Def.Opaque_s.opaque_reveal" ]
[]
false
false
true
false
false
let opaque_revealer #a s x1 x2 =
fun () -> opaque_reveal s x1 x2
false
Lib.NatMod.fsti
Lib.NatMod.mul_mod
val mul_mod (#m: pos) (a b: nat_mod m) : nat_mod m
val mul_mod (#m: pos) (a b: nat_mod m) : nat_mod m
let mul_mod (#m:pos) (a:nat_mod m) (b:nat_mod m) : nat_mod m = a * b % m
{ "file_name": "lib/Lib.NatMod.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 72, "end_line": 54, "start_col": 0, "start_line": 54 }
module Lib.NatMod open FStar.Mul module Fermat = FStar.Math.Fermat module Euclid = FStar.Math.Euclid module LE = Lib.Exponentiation.Definition #set-options "--z3rlimit 10 --fuel 0 --ifuel 0" let mk_nat_comm_monoid : LE.comm_monoid int = { LE.one = 1; LE.mul = FStar.Mul.op_Star; LE.lemma_one = Math.Lemmas.mul_one_right_is_same; LE.lemma_mul_assoc = Math.Lemmas.paren_mul_right; LE.lemma_mul_comm = Math.Lemmas.swap_mul; } let rec pow (x:int) (n:nat) : Tot int = if n = 0 then 1 else x * pow x (n - 1) val lemma_pow0: a:int -> Lemma (pow a 0 = 1) val lemma_pow1: a:int -> Lemma (pow a 1 = a) val lemma_pow_unfold: a:int -> b:pos -> Lemma (a * pow a (b - 1) == pow a b) val lemma_pow_gt_zero: a:pos -> b:nat -> Lemma (pow a b > 0) [SMTPat (pow a b)] val lemma_pow_ge_zero: a:nat -> b:nat -> Lemma (pow a b >= 0) [SMTPat (pow a b)] val lemma_pow_nat_is_pow: a:int -> b:nat -> Lemma (pow a b == LE.pow mk_nat_comm_monoid a b) val lemma_pow_zero: b:pos -> Lemma (pow 0 b = 0) val lemma_pow_one: b:nat -> Lemma (pow 1 b = 1) val lemma_pow_add: x:int -> n:nat -> m:nat -> Lemma (pow x n * pow x m = pow x (n + m)) val lemma_pow_mul: x:int -> n:nat -> m:nat -> Lemma (pow (pow x n) m = pow x (n * m)) val lemma_pow_double: a:int -> b:nat -> Lemma (pow (a * a) b == pow a (b + b)) val lemma_pow_mul_base: a:int -> b:int -> n:nat -> Lemma (pow a n * pow b n == pow (a * b) n) val lemma_pow_mod_base: a:int -> b:nat -> n:pos -> Lemma (pow a b % n == pow (a % n) b % n) let nat_mod (m:pos) = n:nat{n < m}
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Exponentiation.Definition.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Math.Fermat.fsti.checked", "FStar.Math.Euclid.fsti.checked" ], "interface_file": false, "source_file": "Lib.NatMod.fsti" }
[ { "abbrev": true, "full_module": "Lib.Exponentiation.Definition", "short_module": "LE" }, { "abbrev": true, "full_module": "FStar.Math.Euclid", "short_module": "Euclid" }, { "abbrev": true, "full_module": "FStar.Math.Fermat", "short_module": "Fermat" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "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": 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": 10, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Lib.NatMod.nat_mod m -> b: Lib.NatMod.nat_mod m -> Lib.NatMod.nat_mod m
Prims.Tot
[ "total" ]
[]
[ "Prims.pos", "Lib.NatMod.nat_mod", "Prims.op_Modulus", "FStar.Mul.op_Star" ]
[]
false
false
false
false
false
let mul_mod (#m: pos) (a b: nat_mod m) : nat_mod m =
a * b % m
false
FStar.Monotonic.Heap.fsti
FStar.Monotonic.Heap.tset
val tset : a: Type -> Type
let tset = TSet.set
{ "file_name": "ulib/FStar.Monotonic.Heap.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 19, "end_line": 24, "start_col": 0, "start_line": 24 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Monotonic.Heap module S = FStar.Set module TS = FStar.TSet open FStar.Preorder
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.TSet.fsti.checked", "FStar.Set.fsti.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.Monotonic.Heap.fsti" }
[ { "abbrev": false, "full_module": "FStar.Preorder", "short_module": null }, { "abbrev": true, "full_module": "FStar.TSet", "short_module": "TS" }, { "abbrev": true, "full_module": "FStar.Set", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Monotonic", "short_module": null }, { "abbrev": false, "full_module": "FStar.Monotonic", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type -> Type
Prims.Tot
[ "total" ]
[]
[ "FStar.TSet.set" ]
[]
false
false
false
true
true
let tset =
TSet.set
false
FStar.Monotonic.Heap.fsti
FStar.Monotonic.Heap.set
val set : a: Prims.eqtype -> Type0
let set = Set.set
{ "file_name": "ulib/FStar.Monotonic.Heap.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 18, "end_line": 23, "start_col": 0, "start_line": 23 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Monotonic.Heap module S = FStar.Set module TS = FStar.TSet open FStar.Preorder
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.TSet.fsti.checked", "FStar.Set.fsti.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.Monotonic.Heap.fsti" }
[ { "abbrev": false, "full_module": "FStar.Preorder", "short_module": null }, { "abbrev": true, "full_module": "FStar.TSet", "short_module": "TS" }, { "abbrev": true, "full_module": "FStar.Set", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Monotonic", "short_module": null }, { "abbrev": false, "full_module": "FStar.Monotonic", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Prims.eqtype -> Type0
Prims.Tot
[ "total" ]
[]
[ "FStar.Set.set" ]
[]
false
false
false
true
true
let set =
Set.set
false
Lib.NatMod.fsti
Lib.NatMod.mk_nat_comm_monoid
val mk_nat_comm_monoid:LE.comm_monoid int
val mk_nat_comm_monoid:LE.comm_monoid int
let mk_nat_comm_monoid : LE.comm_monoid int = { LE.one = 1; LE.mul = FStar.Mul.op_Star; LE.lemma_one = Math.Lemmas.mul_one_right_is_same; LE.lemma_mul_assoc = Math.Lemmas.paren_mul_right; LE.lemma_mul_comm = Math.Lemmas.swap_mul; }
{ "file_name": "lib/Lib.NatMod.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 3, "end_line": 18, "start_col": 0, "start_line": 12 }
module Lib.NatMod open FStar.Mul module Fermat = FStar.Math.Fermat module Euclid = FStar.Math.Euclid module LE = Lib.Exponentiation.Definition #set-options "--z3rlimit 10 --fuel 0 --ifuel 0"
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Exponentiation.Definition.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Math.Fermat.fsti.checked", "FStar.Math.Euclid.fsti.checked" ], "interface_file": false, "source_file": "Lib.NatMod.fsti" }
[ { "abbrev": true, "full_module": "Lib.Exponentiation.Definition", "short_module": "LE" }, { "abbrev": true, "full_module": "FStar.Math.Euclid", "short_module": "Euclid" }, { "abbrev": true, "full_module": "FStar.Math.Fermat", "short_module": "Fermat" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "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": 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": 10, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Lib.Exponentiation.Definition.comm_monoid Prims.int
Prims.Tot
[ "total" ]
[]
[ "Lib.Exponentiation.Definition.Mkcomm_monoid", "Prims.int", "FStar.Mul.op_Star", "FStar.Math.Lemmas.mul_one_right_is_same", "FStar.Math.Lemmas.paren_mul_right", "FStar.Math.Lemmas.swap_mul" ]
[]
false
false
false
true
false
let mk_nat_comm_monoid:LE.comm_monoid int =
{ LE.one = 1; LE.mul = FStar.Mul.op_Star; LE.lemma_one = Math.Lemmas.mul_one_right_is_same; LE.lemma_mul_assoc = Math.Lemmas.paren_mul_right; LE.lemma_mul_comm = Math.Lemmas.swap_mul }
false
Lib.NatMod.fsti
Lib.NatMod.div_mod
val div_mod (#m: pos{1 < m}) (a b: nat_mod m) : nat_mod m
val div_mod (#m: pos{1 < m}) (a b: nat_mod m) : nat_mod m
let div_mod (#m:pos{1 < m}) (a:nat_mod m) (b:nat_mod m) : nat_mod m = mul_mod a (inv_mod b)
{ "file_name": "lib/Lib.NatMod.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 91, "end_line": 115, "start_col": 0, "start_line": 115 }
module Lib.NatMod open FStar.Mul module Fermat = FStar.Math.Fermat module Euclid = FStar.Math.Euclid module LE = Lib.Exponentiation.Definition #set-options "--z3rlimit 10 --fuel 0 --ifuel 0" let mk_nat_comm_monoid : LE.comm_monoid int = { LE.one = 1; LE.mul = FStar.Mul.op_Star; LE.lemma_one = Math.Lemmas.mul_one_right_is_same; LE.lemma_mul_assoc = Math.Lemmas.paren_mul_right; LE.lemma_mul_comm = Math.Lemmas.swap_mul; } let rec pow (x:int) (n:nat) : Tot int = if n = 0 then 1 else x * pow x (n - 1) val lemma_pow0: a:int -> Lemma (pow a 0 = 1) val lemma_pow1: a:int -> Lemma (pow a 1 = a) val lemma_pow_unfold: a:int -> b:pos -> Lemma (a * pow a (b - 1) == pow a b) val lemma_pow_gt_zero: a:pos -> b:nat -> Lemma (pow a b > 0) [SMTPat (pow a b)] val lemma_pow_ge_zero: a:nat -> b:nat -> Lemma (pow a b >= 0) [SMTPat (pow a b)] val lemma_pow_nat_is_pow: a:int -> b:nat -> Lemma (pow a b == LE.pow mk_nat_comm_monoid a b) val lemma_pow_zero: b:pos -> Lemma (pow 0 b = 0) val lemma_pow_one: b:nat -> Lemma (pow 1 b = 1) val lemma_pow_add: x:int -> n:nat -> m:nat -> Lemma (pow x n * pow x m = pow x (n + m)) val lemma_pow_mul: x:int -> n:nat -> m:nat -> Lemma (pow (pow x n) m = pow x (n * m)) val lemma_pow_double: a:int -> b:nat -> Lemma (pow (a * a) b == pow a (b + b)) val lemma_pow_mul_base: a:int -> b:int -> n:nat -> Lemma (pow a n * pow b n == pow (a * b) n) val lemma_pow_mod_base: a:int -> b:nat -> n:pos -> Lemma (pow a b % n == pow (a % n) b % n) let nat_mod (m:pos) = n:nat{n < m} let one_mod (#m:pos) : nat_mod m = 1 % m let mul_mod (#m:pos) (a:nat_mod m) (b:nat_mod m) : nat_mod m = a * b % m let add_mod (#m:pos) (a:nat_mod m) (b:nat_mod m) : nat_mod m = (a + b) % m let sub_mod (#m:pos) (a:nat_mod m) (b:nat_mod m) : nat_mod m = (a - b) % m val lemma_mul_mod_one: #m:pos -> a:nat_mod m -> Lemma (mul_mod a one_mod == a) val lemma_mul_mod_assoc: #m:pos -> a:nat_mod m -> b:nat_mod m -> c:nat_mod m -> Lemma (mul_mod (mul_mod a b) c == mul_mod a (mul_mod b c)) val lemma_mul_mod_comm: #m:pos -> a:nat_mod m -> b:nat_mod m -> Lemma (mul_mod a b == mul_mod b a) let mk_nat_mod_comm_monoid (m:pos) : LE.comm_monoid (nat_mod m) = { LE.one = one_mod; LE.mul = mul_mod; LE.lemma_one = lemma_mul_mod_one; LE.lemma_mul_assoc = lemma_mul_mod_assoc; LE.lemma_mul_comm = lemma_mul_mod_comm; } inline_for_extraction let rec pow_mod_ (#m:pos{1 < m}) (a:nat_mod m) (b:nat) : Tot (nat_mod m) (decreases b) = if b = 0 then 1 else if b % 2 = 0 then pow_mod_ (mul_mod a a) (b / 2) else mul_mod a (pow_mod_ (mul_mod a a) (b / 2)) val pow_mod: #m:pos{1 < m} -> a:nat_mod m -> b:nat -> nat_mod m val pow_mod_def: #m:pos{1 < m} -> a:nat_mod m -> b:nat -> Lemma (pow_mod a b == pow_mod_ a b) val lemma_pow_mod: #m:pos{1 < m} -> a:nat_mod m -> b:nat -> Lemma (pow a b % m == pow_mod #m a b) val lemma_pow_nat_mod_is_pow: #n:pos{1 < n} -> a:nat_mod n -> b:nat -> Lemma (pow a b % n == LE.pow (mk_nat_mod_comm_monoid n) a b) val lemma_add_mod_one: #m:pos -> a:nat_mod m -> Lemma (add_mod a 0 == a) val lemma_add_mod_assoc: #m:pos -> a:nat_mod m -> b:nat_mod m -> c:nat_mod m -> Lemma (add_mod (add_mod a b) c == add_mod a (add_mod b c)) val lemma_add_mod_comm: #m:pos -> a:nat_mod m -> b:nat_mod m -> Lemma (add_mod a b == add_mod b a) val lemma_mod_distributivity_add_right: #m:pos -> a:nat_mod m -> b:nat_mod m -> c:nat_mod m -> Lemma (mul_mod a (add_mod b c) == add_mod (mul_mod a b) (mul_mod a c)) val lemma_mod_distributivity_add_left: #m:pos -> a:nat_mod m -> b:nat_mod m -> c:nat_mod m -> Lemma (mul_mod (add_mod a b) c == add_mod (mul_mod a c) (mul_mod b c)) val lemma_mod_distributivity_sub_right: #m:pos -> a:nat_mod m -> b:nat_mod m -> c:nat_mod m -> Lemma (mul_mod a (sub_mod b c) == sub_mod (mul_mod a b) (mul_mod a c)) val lemma_mod_distributivity_sub_left: #m:pos -> a:nat_mod m -> b:nat_mod m -> c:nat_mod m -> Lemma (mul_mod (sub_mod a b) c == sub_mod (mul_mod a c) (mul_mod b c)) let prime = m:pos{1 < m /\ Euclid.is_prime m}
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Exponentiation.Definition.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Math.Fermat.fsti.checked", "FStar.Math.Euclid.fsti.checked" ], "interface_file": false, "source_file": "Lib.NatMod.fsti" }
[ { "abbrev": true, "full_module": "Lib.Exponentiation.Definition", "short_module": "LE" }, { "abbrev": true, "full_module": "FStar.Math.Euclid", "short_module": "Euclid" }, { "abbrev": true, "full_module": "FStar.Math.Fermat", "short_module": "Fermat" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "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": 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": 10, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Lib.NatMod.nat_mod m -> b: Lib.NatMod.nat_mod m -> Lib.NatMod.nat_mod m
Prims.Tot
[ "total" ]
[]
[ "Prims.pos", "Prims.b2t", "Prims.op_LessThan", "Lib.NatMod.nat_mod", "Lib.NatMod.mul_mod", "Lib.NatMod.inv_mod" ]
[]
false
false
false
false
false
let div_mod (#m: pos{1 < m}) (a b: nat_mod m) : nat_mod m =
mul_mod a (inv_mod b)
false
Vale.Def.Opaque_s.fst
Vale.Def.Opaque_s.opaque_assert
val opaque_assert (#a:Type) (s:string) (x1 x2:a) (p:Type0) : Lemma (requires norm [delta_only [s]] (x1 == opaque_make x2) /\ (x1 == x2 ==> p)) (ensures p)
val opaque_assert (#a:Type) (s:string) (x1 x2:a) (p:Type0) : Lemma (requires norm [delta_only [s]] (x1 == opaque_make x2) /\ (x1 == x2 ==> p)) (ensures p)
let opaque_assert #a s x1 x2 p = norm_spec [delta_only [s]] (x1 == opaque_make x2)
{ "file_name": "vale/specs/defs/Vale.Def.Opaque_s.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 51, "end_line": 10, "start_col": 0, "start_line": 9 }
module Vale.Def.Opaque_s open FStar.Mul let opaque_make #a x = x let opaque_reveal #a s x1 x2 = norm_spec [delta_only [s]] (x1 == opaque_make x2)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": true, "source_file": "Vale.Def.Opaque_s.fst" }
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": 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
s: Prims.string -> x1: a -> x2: a -> p: Type0 -> FStar.Pervasives.Lemma (requires FStar.Pervasives.norm [FStar.Pervasives.delta_only [s]] (x1 == Vale.Def.Opaque_s.opaque_make x2) /\ (x1 == x2 ==> p)) (ensures p)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims.string", "FStar.Pervasives.norm_spec", "Prims.Cons", "FStar.Pervasives.norm_step", "FStar.Pervasives.delta_only", "Prims.Nil", "Prims.logical", "Prims.eq2", "Vale.Def.Opaque_s.opaque_make", "Prims.unit" ]
[]
true
false
true
false
false
let opaque_assert #a s x1 x2 p =
norm_spec [delta_only [s]] (x1 == opaque_make x2)
false
FStar.Monotonic.Heap.fsti
FStar.Monotonic.Heap.mref
val mref (a: Type0) (rel: preorder a) : Type0
val mref (a: Type0) (rel: preorder a) : Type0
let mref (a:Type0) (rel:preorder a) : Type0 = core_mref a
{ "file_name": "ulib/FStar.Monotonic.Heap.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 57, "end_line": 40, "start_col": 0, "start_line": 40 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Monotonic.Heap module S = FStar.Set module TS = FStar.TSet open FStar.Preorder let set = Set.set let tset = TSet.set val heap :Type u#1 val equal: heap -> heap -> Type0 val equal_extensional (h1:heap) (h2:heap) :Lemma (requires True) (ensures (equal h1 h2 <==> h1 == h2)) [SMTPat (equal h1 h2)] val emp :heap val next_addr: heap -> GTot pos val core_mref ([@@@ strictly_positive] a:Type0) : Type0
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.TSet.fsti.checked", "FStar.Set.fsti.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.Monotonic.Heap.fsti" }
[ { "abbrev": true, "full_module": "FStar.FunctionalExtensionality", "short_module": "F" }, { "abbrev": false, "full_module": "FStar.Classical", "short_module": null }, { "abbrev": false, "full_module": "FStar.Preorder", "short_module": null }, { "abbrev": false, "full_module": "FStar.Preorder", "short_module": null }, { "abbrev": true, "full_module": "FStar.TSet", "short_module": "TS" }, { "abbrev": true, "full_module": "FStar.Set", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Monotonic", "short_module": null }, { "abbrev": false, "full_module": "FStar.Monotonic", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Type0 -> rel: FStar.Preorder.preorder a -> Type0
Prims.Tot
[ "total" ]
[]
[ "FStar.Preorder.preorder", "FStar.Monotonic.Heap.core_mref" ]
[]
false
false
false
true
true
let mref (a: Type0) (rel: preorder a) : Type0 =
core_mref a
false
Lib.NatMod.fsti
Lib.NatMod.one_mod
val one_mod (#m: pos) : nat_mod m
val one_mod (#m: pos) : nat_mod m
let one_mod (#m:pos) : nat_mod m = 1 % m
{ "file_name": "lib/Lib.NatMod.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 40, "end_line": 53, "start_col": 0, "start_line": 53 }
module Lib.NatMod open FStar.Mul module Fermat = FStar.Math.Fermat module Euclid = FStar.Math.Euclid module LE = Lib.Exponentiation.Definition #set-options "--z3rlimit 10 --fuel 0 --ifuel 0" let mk_nat_comm_monoid : LE.comm_monoid int = { LE.one = 1; LE.mul = FStar.Mul.op_Star; LE.lemma_one = Math.Lemmas.mul_one_right_is_same; LE.lemma_mul_assoc = Math.Lemmas.paren_mul_right; LE.lemma_mul_comm = Math.Lemmas.swap_mul; } let rec pow (x:int) (n:nat) : Tot int = if n = 0 then 1 else x * pow x (n - 1) val lemma_pow0: a:int -> Lemma (pow a 0 = 1) val lemma_pow1: a:int -> Lemma (pow a 1 = a) val lemma_pow_unfold: a:int -> b:pos -> Lemma (a * pow a (b - 1) == pow a b) val lemma_pow_gt_zero: a:pos -> b:nat -> Lemma (pow a b > 0) [SMTPat (pow a b)] val lemma_pow_ge_zero: a:nat -> b:nat -> Lemma (pow a b >= 0) [SMTPat (pow a b)] val lemma_pow_nat_is_pow: a:int -> b:nat -> Lemma (pow a b == LE.pow mk_nat_comm_monoid a b) val lemma_pow_zero: b:pos -> Lemma (pow 0 b = 0) val lemma_pow_one: b:nat -> Lemma (pow 1 b = 1) val lemma_pow_add: x:int -> n:nat -> m:nat -> Lemma (pow x n * pow x m = pow x (n + m)) val lemma_pow_mul: x:int -> n:nat -> m:nat -> Lemma (pow (pow x n) m = pow x (n * m)) val lemma_pow_double: a:int -> b:nat -> Lemma (pow (a * a) b == pow a (b + b)) val lemma_pow_mul_base: a:int -> b:int -> n:nat -> Lemma (pow a n * pow b n == pow (a * b) n) val lemma_pow_mod_base: a:int -> b:nat -> n:pos -> Lemma (pow a b % n == pow (a % n) b % n) let nat_mod (m:pos) = n:nat{n < m}
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Exponentiation.Definition.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Math.Fermat.fsti.checked", "FStar.Math.Euclid.fsti.checked" ], "interface_file": false, "source_file": "Lib.NatMod.fsti" }
[ { "abbrev": true, "full_module": "Lib.Exponentiation.Definition", "short_module": "LE" }, { "abbrev": true, "full_module": "FStar.Math.Euclid", "short_module": "Euclid" }, { "abbrev": true, "full_module": "FStar.Math.Fermat", "short_module": "Fermat" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "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": 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": 10, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Lib.NatMod.nat_mod m
Prims.Tot
[ "total" ]
[]
[ "Prims.pos", "Prims.op_Modulus", "Lib.NatMod.nat_mod" ]
[]
false
false
false
false
false
let one_mod (#m: pos) : nat_mod m =
1 % m
false
FStar.Monotonic.Heap.fsti
FStar.Monotonic.Heap.fresh
val fresh : r: FStar.Monotonic.Heap.mref a rel -> h0: FStar.Monotonic.Heap.heap -> h1: FStar.Monotonic.Heap.heap -> Prims.logical
let fresh (#a:Type) (#rel:preorder a) (r:mref a rel) (h0:heap) (h1:heap) = r `unused_in` h0 /\ h1 `contains` r
{ "file_name": "ulib/FStar.Monotonic.Heap.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 37, "end_line": 58, "start_col": 0, "start_line": 57 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Monotonic.Heap module S = FStar.Set module TS = FStar.TSet open FStar.Preorder let set = Set.set let tset = TSet.set val heap :Type u#1 val equal: heap -> heap -> Type0 val equal_extensional (h1:heap) (h2:heap) :Lemma (requires True) (ensures (equal h1 h2 <==> h1 == h2)) [SMTPat (equal h1 h2)] val emp :heap val next_addr: heap -> GTot pos val core_mref ([@@@ strictly_positive] a:Type0) : Type0 let mref (a:Type0) (rel:preorder a) : Type0 = core_mref a val addr_of: #a:Type0 -> #rel:preorder a -> mref a rel -> GTot pos val is_mm: #a:Type0 -> #rel:preorder a -> mref a rel -> GTot bool let compare_addrs (#a #b:Type0) (#rel1:preorder a) (#rel2:preorder b) (r1:mref a rel1) (r2:mref b rel2) :GTot bool = addr_of r1 = addr_of r2 val contains: #a:Type0 -> #rel:preorder a -> heap -> mref a rel -> Type0 val addr_unused_in: nat -> heap -> Type0 val not_addr_unused_in_nullptr (h: heap) : Lemma (~ (addr_unused_in 0 h)) val unused_in: #a:Type0 -> #rel:preorder a -> mref a rel -> heap -> Type0
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.TSet.fsti.checked", "FStar.Set.fsti.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.Monotonic.Heap.fsti" }
[ { "abbrev": true, "full_module": "FStar.FunctionalExtensionality", "short_module": "F" }, { "abbrev": false, "full_module": "FStar.Classical", "short_module": null }, { "abbrev": false, "full_module": "FStar.Preorder", "short_module": null }, { "abbrev": false, "full_module": "FStar.Preorder", "short_module": null }, { "abbrev": true, "full_module": "FStar.TSet", "short_module": "TS" }, { "abbrev": true, "full_module": "FStar.Set", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Monotonic", "short_module": null }, { "abbrev": false, "full_module": "FStar.Monotonic", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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.Monotonic.Heap.mref a rel -> h0: FStar.Monotonic.Heap.heap -> h1: FStar.Monotonic.Heap.heap -> Prims.logical
Prims.Tot
[ "total" ]
[]
[ "FStar.Preorder.preorder", "FStar.Monotonic.Heap.mref", "FStar.Monotonic.Heap.heap", "Prims.l_and", "FStar.Monotonic.Heap.unused_in", "FStar.Monotonic.Heap.contains", "Prims.logical" ]
[]
false
false
false
false
true
let fresh (#a: Type) (#rel: preorder a) (r: mref a rel) (h0 h1: heap) =
r `unused_in` h0 /\ h1 `contains` r
false
Lib.NatMod.fsti
Lib.NatMod.sub_mod
val sub_mod (#m: pos) (a b: nat_mod m) : nat_mod m
val sub_mod (#m: pos) (a b: nat_mod m) : nat_mod m
let sub_mod (#m:pos) (a:nat_mod m) (b:nat_mod m) : nat_mod m = (a - b) % m
{ "file_name": "lib/Lib.NatMod.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 74, "end_line": 56, "start_col": 0, "start_line": 56 }
module Lib.NatMod open FStar.Mul module Fermat = FStar.Math.Fermat module Euclid = FStar.Math.Euclid module LE = Lib.Exponentiation.Definition #set-options "--z3rlimit 10 --fuel 0 --ifuel 0" let mk_nat_comm_monoid : LE.comm_monoid int = { LE.one = 1; LE.mul = FStar.Mul.op_Star; LE.lemma_one = Math.Lemmas.mul_one_right_is_same; LE.lemma_mul_assoc = Math.Lemmas.paren_mul_right; LE.lemma_mul_comm = Math.Lemmas.swap_mul; } let rec pow (x:int) (n:nat) : Tot int = if n = 0 then 1 else x * pow x (n - 1) val lemma_pow0: a:int -> Lemma (pow a 0 = 1) val lemma_pow1: a:int -> Lemma (pow a 1 = a) val lemma_pow_unfold: a:int -> b:pos -> Lemma (a * pow a (b - 1) == pow a b) val lemma_pow_gt_zero: a:pos -> b:nat -> Lemma (pow a b > 0) [SMTPat (pow a b)] val lemma_pow_ge_zero: a:nat -> b:nat -> Lemma (pow a b >= 0) [SMTPat (pow a b)] val lemma_pow_nat_is_pow: a:int -> b:nat -> Lemma (pow a b == LE.pow mk_nat_comm_monoid a b) val lemma_pow_zero: b:pos -> Lemma (pow 0 b = 0) val lemma_pow_one: b:nat -> Lemma (pow 1 b = 1) val lemma_pow_add: x:int -> n:nat -> m:nat -> Lemma (pow x n * pow x m = pow x (n + m)) val lemma_pow_mul: x:int -> n:nat -> m:nat -> Lemma (pow (pow x n) m = pow x (n * m)) val lemma_pow_double: a:int -> b:nat -> Lemma (pow (a * a) b == pow a (b + b)) val lemma_pow_mul_base: a:int -> b:int -> n:nat -> Lemma (pow a n * pow b n == pow (a * b) n) val lemma_pow_mod_base: a:int -> b:nat -> n:pos -> Lemma (pow a b % n == pow (a % n) b % n) let nat_mod (m:pos) = n:nat{n < m} let one_mod (#m:pos) : nat_mod m = 1 % m let mul_mod (#m:pos) (a:nat_mod m) (b:nat_mod m) : nat_mod m = a * b % m
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Exponentiation.Definition.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Math.Fermat.fsti.checked", "FStar.Math.Euclid.fsti.checked" ], "interface_file": false, "source_file": "Lib.NatMod.fsti" }
[ { "abbrev": true, "full_module": "Lib.Exponentiation.Definition", "short_module": "LE" }, { "abbrev": true, "full_module": "FStar.Math.Euclid", "short_module": "Euclid" }, { "abbrev": true, "full_module": "FStar.Math.Fermat", "short_module": "Fermat" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "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": 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": 10, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Lib.NatMod.nat_mod m -> b: Lib.NatMod.nat_mod m -> Lib.NatMod.nat_mod m
Prims.Tot
[ "total" ]
[]
[ "Prims.pos", "Lib.NatMod.nat_mod", "Prims.op_Modulus", "Prims.op_Subtraction" ]
[]
false
false
false
false
false
let sub_mod (#m: pos) (a b: nat_mod m) : nat_mod m =
(a - b) % m
false
FStar.Monotonic.Heap.fsti
FStar.Monotonic.Heap.equal_dom
val equal_dom (h1 h2: heap) : GTot Type0
val equal_dom (h1 h2: heap) : GTot Type0
let equal_dom (h1:heap) (h2:heap) :GTot Type0 = (forall (a:Type0) (rel:preorder a) (r:mref a rel). {:pattern (h1 `contains` r) \/ (h2 `contains` r)} h1 `contains` r <==> h2 `contains` r) /\ (forall (a:Type0) (rel:preorder a) (r:mref a rel). {:pattern (r `unused_in` h1) \/ (r `unused_in` h2)} r `unused_in` h1 <==> r `unused_in` h2)
{ "file_name": "ulib/FStar.Monotonic.Heap.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 44, "end_line": 103, "start_col": 0, "start_line": 97 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Monotonic.Heap module S = FStar.Set module TS = FStar.TSet open FStar.Preorder let set = Set.set let tset = TSet.set val heap :Type u#1 val equal: heap -> heap -> Type0 val equal_extensional (h1:heap) (h2:heap) :Lemma (requires True) (ensures (equal h1 h2 <==> h1 == h2)) [SMTPat (equal h1 h2)] val emp :heap val next_addr: heap -> GTot pos val core_mref ([@@@ strictly_positive] a:Type0) : Type0 let mref (a:Type0) (rel:preorder a) : Type0 = core_mref a val addr_of: #a:Type0 -> #rel:preorder a -> mref a rel -> GTot pos val is_mm: #a:Type0 -> #rel:preorder a -> mref a rel -> GTot bool let compare_addrs (#a #b:Type0) (#rel1:preorder a) (#rel2:preorder b) (r1:mref a rel1) (r2:mref b rel2) :GTot bool = addr_of r1 = addr_of r2 val contains: #a:Type0 -> #rel:preorder a -> heap -> mref a rel -> Type0 val addr_unused_in: nat -> heap -> Type0 val not_addr_unused_in_nullptr (h: heap) : Lemma (~ (addr_unused_in 0 h)) val unused_in: #a:Type0 -> #rel:preorder a -> mref a rel -> heap -> Type0 let fresh (#a:Type) (#rel:preorder a) (r:mref a rel) (h0:heap) (h1:heap) = r `unused_in` h0 /\ h1 `contains` r let only_t (#a:Type0) (#rel:preorder a) (x:mref a rel) :GTot (tset nat) = TS.singleton (addr_of x) let only (#a:Type0) (#rel:preorder a) (x:mref a rel) :GTot (set nat) = S.singleton (addr_of x) let op_Hat_Plus_Plus (#a:Type0) (#rel:preorder a) (r:mref a rel) (s:set nat) :GTot (set nat) = S.union (only r) s let op_Plus_Plus_Hat (#a:Type0) (#rel:preorder a) (s:set nat) (r:mref a rel) :GTot (set nat) = S.union s (only r) let op_Hat_Plus_Hat (#a:Type0) (#b:Type0) (#rel1:preorder a) (#rel2:preorder b) (r1:mref a rel1) (r2:mref b rel2) :GTot (set nat) = S.union (only r1) (only r2) val sel_tot: #a:Type0 -> #rel:preorder a -> h:heap -> r:mref a rel{h `contains` r} -> Tot a val sel: #a:Type0 -> #rel:preorder a -> heap -> mref a rel -> GTot a val upd_tot: #a:Type0 -> #rel:preorder a -> h:heap -> r:mref a rel{h `contains` r} -> x:a -> Tot heap val upd: #a:Type0 -> #rel:preorder a -> h:heap -> r:mref a rel -> x:a -> GTot heap val alloc: #a:Type0 -> rel:preorder a -> heap -> a -> mm:bool -> Tot (mref a rel * heap) val free_mm: #a:Type0 -> #rel:preorder a -> h:heap -> r:mref a rel{h `contains` r /\ is_mm r} -> Tot heap let modifies_t (s:tset nat) (h0:heap) (h1:heap) = (forall (a:Type) (rel:preorder a) (r:mref a rel).{:pattern (sel h1 r)} ((~ (TS.mem (addr_of r) s)) /\ h0 `contains` r) ==> sel h1 r == sel h0 r) /\ (forall (a:Type) (rel:preorder a) (r:mref a rel).{:pattern (contains h1 r)} h0 `contains` r ==> h1 `contains` r) /\ (forall (a:Type) (rel:preorder a) (r:mref a rel).{:pattern (r `unused_in` h0)} r `unused_in` h1 ==> r `unused_in` h0) /\ (forall (n: nat) . {:pattern (n `addr_unused_in` h0) } n `addr_unused_in` h1 ==> n `addr_unused_in` h0 ) let modifies (s:set nat) (h0:heap) (h1:heap) = modifies_t (TS.tset_of_set s) h0 h1
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.TSet.fsti.checked", "FStar.Set.fsti.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.Monotonic.Heap.fsti" }
[ { "abbrev": true, "full_module": "FStar.FunctionalExtensionality", "short_module": "F" }, { "abbrev": false, "full_module": "FStar.Classical", "short_module": null }, { "abbrev": false, "full_module": "FStar.Preorder", "short_module": null }, { "abbrev": false, "full_module": "FStar.Preorder", "short_module": null }, { "abbrev": true, "full_module": "FStar.TSet", "short_module": "TS" }, { "abbrev": true, "full_module": "FStar.Set", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Monotonic", "short_module": null }, { "abbrev": false, "full_module": "FStar.Monotonic", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
h1: FStar.Monotonic.Heap.heap -> h2: FStar.Monotonic.Heap.heap -> Prims.GTot Type0
Prims.GTot
[ "sometrivial" ]
[]
[ "FStar.Monotonic.Heap.heap", "Prims.l_and", "Prims.l_Forall", "FStar.Preorder.preorder", "FStar.Monotonic.Heap.mref", "Prims.l_iff", "FStar.Monotonic.Heap.contains", "FStar.Monotonic.Heap.unused_in" ]
[]
false
false
false
false
true
let equal_dom (h1 h2: heap) : GTot Type0 =
(forall (a: Type0) (rel: preorder a) (r: mref a rel). {:pattern (h1 `contains` r)\/(h2 `contains` r)} h1 `contains` r <==> h2 `contains` r) /\ (forall (a: Type0) (rel: preorder a) (r: mref a rel). {:pattern (r `unused_in` h1)\/(r `unused_in` h2)} r `unused_in` h1 <==> r `unused_in` h2)
false
Lib.NatMod.fsti
Lib.NatMod.pow_mod_
val pow_mod_ (#m: pos{1 < m}) (a: nat_mod m) (b: nat) : Tot (nat_mod m) (decreases b)
val pow_mod_ (#m: pos{1 < m}) (a: nat_mod m) (b: nat) : Tot (nat_mod m) (decreases b)
let rec pow_mod_ (#m:pos{1 < m}) (a:nat_mod m) (b:nat) : Tot (nat_mod m) (decreases b) = if b = 0 then 1 else if b % 2 = 0 then pow_mod_ (mul_mod a a) (b / 2) else mul_mod a (pow_mod_ (mul_mod a a) (b / 2))
{ "file_name": "lib/Lib.NatMod.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 51, "end_line": 79, "start_col": 0, "start_line": 75 }
module Lib.NatMod open FStar.Mul module Fermat = FStar.Math.Fermat module Euclid = FStar.Math.Euclid module LE = Lib.Exponentiation.Definition #set-options "--z3rlimit 10 --fuel 0 --ifuel 0" let mk_nat_comm_monoid : LE.comm_monoid int = { LE.one = 1; LE.mul = FStar.Mul.op_Star; LE.lemma_one = Math.Lemmas.mul_one_right_is_same; LE.lemma_mul_assoc = Math.Lemmas.paren_mul_right; LE.lemma_mul_comm = Math.Lemmas.swap_mul; } let rec pow (x:int) (n:nat) : Tot int = if n = 0 then 1 else x * pow x (n - 1) val lemma_pow0: a:int -> Lemma (pow a 0 = 1) val lemma_pow1: a:int -> Lemma (pow a 1 = a) val lemma_pow_unfold: a:int -> b:pos -> Lemma (a * pow a (b - 1) == pow a b) val lemma_pow_gt_zero: a:pos -> b:nat -> Lemma (pow a b > 0) [SMTPat (pow a b)] val lemma_pow_ge_zero: a:nat -> b:nat -> Lemma (pow a b >= 0) [SMTPat (pow a b)] val lemma_pow_nat_is_pow: a:int -> b:nat -> Lemma (pow a b == LE.pow mk_nat_comm_monoid a b) val lemma_pow_zero: b:pos -> Lemma (pow 0 b = 0) val lemma_pow_one: b:nat -> Lemma (pow 1 b = 1) val lemma_pow_add: x:int -> n:nat -> m:nat -> Lemma (pow x n * pow x m = pow x (n + m)) val lemma_pow_mul: x:int -> n:nat -> m:nat -> Lemma (pow (pow x n) m = pow x (n * m)) val lemma_pow_double: a:int -> b:nat -> Lemma (pow (a * a) b == pow a (b + b)) val lemma_pow_mul_base: a:int -> b:int -> n:nat -> Lemma (pow a n * pow b n == pow (a * b) n) val lemma_pow_mod_base: a:int -> b:nat -> n:pos -> Lemma (pow a b % n == pow (a % n) b % n) let nat_mod (m:pos) = n:nat{n < m} let one_mod (#m:pos) : nat_mod m = 1 % m let mul_mod (#m:pos) (a:nat_mod m) (b:nat_mod m) : nat_mod m = a * b % m let add_mod (#m:pos) (a:nat_mod m) (b:nat_mod m) : nat_mod m = (a + b) % m let sub_mod (#m:pos) (a:nat_mod m) (b:nat_mod m) : nat_mod m = (a - b) % m val lemma_mul_mod_one: #m:pos -> a:nat_mod m -> Lemma (mul_mod a one_mod == a) val lemma_mul_mod_assoc: #m:pos -> a:nat_mod m -> b:nat_mod m -> c:nat_mod m -> Lemma (mul_mod (mul_mod a b) c == mul_mod a (mul_mod b c)) val lemma_mul_mod_comm: #m:pos -> a:nat_mod m -> b:nat_mod m -> Lemma (mul_mod a b == mul_mod b a) let mk_nat_mod_comm_monoid (m:pos) : LE.comm_monoid (nat_mod m) = { LE.one = one_mod; LE.mul = mul_mod; LE.lemma_one = lemma_mul_mod_one; LE.lemma_mul_assoc = lemma_mul_mod_assoc; LE.lemma_mul_comm = lemma_mul_mod_comm; }
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Exponentiation.Definition.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Math.Fermat.fsti.checked", "FStar.Math.Euclid.fsti.checked" ], "interface_file": false, "source_file": "Lib.NatMod.fsti" }
[ { "abbrev": true, "full_module": "Lib.Exponentiation.Definition", "short_module": "LE" }, { "abbrev": true, "full_module": "FStar.Math.Euclid", "short_module": "Euclid" }, { "abbrev": true, "full_module": "FStar.Math.Fermat", "short_module": "Fermat" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "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": 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": 10, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Lib.NatMod.nat_mod m -> b: Prims.nat -> Prims.Tot (Lib.NatMod.nat_mod m)
Prims.Tot
[ "total", "" ]
[]
[ "Prims.pos", "Prims.b2t", "Prims.op_LessThan", "Lib.NatMod.nat_mod", "Prims.nat", "Prims.op_Equality", "Prims.int", "Prims.bool", "Prims.op_Modulus", "Lib.NatMod.pow_mod_", "Lib.NatMod.mul_mod", "Prims.op_Division" ]
[ "recursion" ]
false
false
false
false
false
let rec pow_mod_ (#m: pos{1 < m}) (a: nat_mod m) (b: nat) : Tot (nat_mod m) (decreases b) =
if b = 0 then 1 else if b % 2 = 0 then pow_mod_ (mul_mod a a) (b / 2) else mul_mod a (pow_mod_ (mul_mod a a) (b / 2))
false
Lib.NatMod.fsti
Lib.NatMod.add_mod
val add_mod (#m: pos) (a b: nat_mod m) : nat_mod m
val add_mod (#m: pos) (a b: nat_mod m) : nat_mod m
let add_mod (#m:pos) (a:nat_mod m) (b:nat_mod m) : nat_mod m = (a + b) % m
{ "file_name": "lib/Lib.NatMod.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 74, "end_line": 55, "start_col": 0, "start_line": 55 }
module Lib.NatMod open FStar.Mul module Fermat = FStar.Math.Fermat module Euclid = FStar.Math.Euclid module LE = Lib.Exponentiation.Definition #set-options "--z3rlimit 10 --fuel 0 --ifuel 0" let mk_nat_comm_monoid : LE.comm_monoid int = { LE.one = 1; LE.mul = FStar.Mul.op_Star; LE.lemma_one = Math.Lemmas.mul_one_right_is_same; LE.lemma_mul_assoc = Math.Lemmas.paren_mul_right; LE.lemma_mul_comm = Math.Lemmas.swap_mul; } let rec pow (x:int) (n:nat) : Tot int = if n = 0 then 1 else x * pow x (n - 1) val lemma_pow0: a:int -> Lemma (pow a 0 = 1) val lemma_pow1: a:int -> Lemma (pow a 1 = a) val lemma_pow_unfold: a:int -> b:pos -> Lemma (a * pow a (b - 1) == pow a b) val lemma_pow_gt_zero: a:pos -> b:nat -> Lemma (pow a b > 0) [SMTPat (pow a b)] val lemma_pow_ge_zero: a:nat -> b:nat -> Lemma (pow a b >= 0) [SMTPat (pow a b)] val lemma_pow_nat_is_pow: a:int -> b:nat -> Lemma (pow a b == LE.pow mk_nat_comm_monoid a b) val lemma_pow_zero: b:pos -> Lemma (pow 0 b = 0) val lemma_pow_one: b:nat -> Lemma (pow 1 b = 1) val lemma_pow_add: x:int -> n:nat -> m:nat -> Lemma (pow x n * pow x m = pow x (n + m)) val lemma_pow_mul: x:int -> n:nat -> m:nat -> Lemma (pow (pow x n) m = pow x (n * m)) val lemma_pow_double: a:int -> b:nat -> Lemma (pow (a * a) b == pow a (b + b)) val lemma_pow_mul_base: a:int -> b:int -> n:nat -> Lemma (pow a n * pow b n == pow (a * b) n) val lemma_pow_mod_base: a:int -> b:nat -> n:pos -> Lemma (pow a b % n == pow (a % n) b % n) let nat_mod (m:pos) = n:nat{n < m} let one_mod (#m:pos) : nat_mod m = 1 % m
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Exponentiation.Definition.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Math.Fermat.fsti.checked", "FStar.Math.Euclid.fsti.checked" ], "interface_file": false, "source_file": "Lib.NatMod.fsti" }
[ { "abbrev": true, "full_module": "Lib.Exponentiation.Definition", "short_module": "LE" }, { "abbrev": true, "full_module": "FStar.Math.Euclid", "short_module": "Euclid" }, { "abbrev": true, "full_module": "FStar.Math.Fermat", "short_module": "Fermat" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "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": 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": 10, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Lib.NatMod.nat_mod m -> b: Lib.NatMod.nat_mod m -> Lib.NatMod.nat_mod m
Prims.Tot
[ "total" ]
[]
[ "Prims.pos", "Lib.NatMod.nat_mod", "Prims.op_Modulus", "Prims.op_Addition" ]
[]
false
false
false
false
false
let add_mod (#m: pos) (a b: nat_mod m) : nat_mod m =
(a + b) % m
false
Lib.NatMod.fsti
Lib.NatMod.pow
val pow (x: int) (n: nat) : Tot int
val pow (x: int) (n: nat) : Tot int
let rec pow (x:int) (n:nat) : Tot int = if n = 0 then 1 else x * pow x (n - 1)
{ "file_name": "lib/Lib.NatMod.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 24, "end_line": 23, "start_col": 0, "start_line": 21 }
module Lib.NatMod open FStar.Mul module Fermat = FStar.Math.Fermat module Euclid = FStar.Math.Euclid module LE = Lib.Exponentiation.Definition #set-options "--z3rlimit 10 --fuel 0 --ifuel 0" let mk_nat_comm_monoid : LE.comm_monoid int = { LE.one = 1; LE.mul = FStar.Mul.op_Star; LE.lemma_one = Math.Lemmas.mul_one_right_is_same; LE.lemma_mul_assoc = Math.Lemmas.paren_mul_right; LE.lemma_mul_comm = Math.Lemmas.swap_mul; }
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Exponentiation.Definition.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Math.Fermat.fsti.checked", "FStar.Math.Euclid.fsti.checked" ], "interface_file": false, "source_file": "Lib.NatMod.fsti" }
[ { "abbrev": true, "full_module": "Lib.Exponentiation.Definition", "short_module": "LE" }, { "abbrev": true, "full_module": "FStar.Math.Euclid", "short_module": "Euclid" }, { "abbrev": true, "full_module": "FStar.Math.Fermat", "short_module": "Fermat" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "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": 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": 10, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: Prims.int -> n: Prims.nat -> Prims.int
Prims.Tot
[ "total" ]
[]
[ "Prims.int", "Prims.nat", "Prims.op_Equality", "Prims.bool", "FStar.Mul.op_Star", "Lib.NatMod.pow", "Prims.op_Subtraction" ]
[ "recursion" ]
false
false
false
true
false
let rec pow (x: int) (n: nat) : Tot int =
if n = 0 then 1 else x * pow x (n - 1)
false
FStar.Monotonic.Heap.fsti
FStar.Monotonic.Heap.compare_addrs
val compare_addrs (#a #b: Type0) (#rel1: preorder a) (#rel2: preorder b) (r1: mref a rel1) (r2: mref b rel2) : GTot bool
val compare_addrs (#a #b: Type0) (#rel1: preorder a) (#rel2: preorder b) (r1: mref a rel1) (r2: mref b rel2) : GTot bool
let compare_addrs (#a #b:Type0) (#rel1:preorder a) (#rel2:preorder b) (r1:mref a rel1) (r2:mref b rel2) :GTot bool = addr_of r1 = addr_of r2
{ "file_name": "ulib/FStar.Monotonic.Heap.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 38, "end_line": 47, "start_col": 0, "start_line": 46 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Monotonic.Heap module S = FStar.Set module TS = FStar.TSet open FStar.Preorder let set = Set.set let tset = TSet.set val heap :Type u#1 val equal: heap -> heap -> Type0 val equal_extensional (h1:heap) (h2:heap) :Lemma (requires True) (ensures (equal h1 h2 <==> h1 == h2)) [SMTPat (equal h1 h2)] val emp :heap val next_addr: heap -> GTot pos val core_mref ([@@@ strictly_positive] a:Type0) : Type0 let mref (a:Type0) (rel:preorder a) : Type0 = core_mref a val addr_of: #a:Type0 -> #rel:preorder a -> mref a rel -> GTot pos val is_mm: #a:Type0 -> #rel:preorder a -> mref a rel -> GTot bool
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.TSet.fsti.checked", "FStar.Set.fsti.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.Monotonic.Heap.fsti" }
[ { "abbrev": true, "full_module": "FStar.FunctionalExtensionality", "short_module": "F" }, { "abbrev": false, "full_module": "FStar.Classical", "short_module": null }, { "abbrev": false, "full_module": "FStar.Preorder", "short_module": null }, { "abbrev": false, "full_module": "FStar.Preorder", "short_module": null }, { "abbrev": true, "full_module": "FStar.TSet", "short_module": "TS" }, { "abbrev": true, "full_module": "FStar.Set", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Monotonic", "short_module": null }, { "abbrev": false, "full_module": "FStar.Monotonic", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
r1: FStar.Monotonic.Heap.mref a rel1 -> r2: FStar.Monotonic.Heap.mref b rel2 -> Prims.GTot Prims.bool
Prims.GTot
[ "sometrivial" ]
[]
[ "FStar.Preorder.preorder", "FStar.Monotonic.Heap.mref", "Prims.op_Equality", "Prims.pos", "FStar.Monotonic.Heap.addr_of", "Prims.bool" ]
[]
false
false
false
false
false
let compare_addrs (#a #b: Type0) (#rel1: preorder a) (#rel2: preorder b) (r1: mref a rel1) (r2: mref b rel2) : GTot bool =
addr_of r1 = addr_of r2
false
Vale.Math.Poly2.Bits.fsti
Vale.Math.Poly2.Bits.poly128_of_nat32s
val poly128_of_nat32s (a0 a1 a2 a3: nat32) : poly
val poly128_of_nat32s (a0 a1 a2 a3: nat32) : poly
let poly128_of_nat32s (a0 a1 a2 a3:nat32) : poly = poly128_of_poly32s (of_nat32 a0) (of_nat32 a1) (of_nat32 a2) (of_nat32 a3)
{ "file_name": "vale/code/lib/math/Vale.Math.Poly2.Bits.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 76, "end_line": 59, "start_col": 0, "start_line": 58 }
module Vale.Math.Poly2.Bits open FStar.Mul open Vale.Def.Words_s open Vale.Def.Types_s open FStar.UInt open FStar.Seq open Vale.Arch.Types open Vale.Math.Poly2_s open Vale.Math.Poly2.Bits_s open Vale.Math.Poly2 open Vale.Math.Poly2.Lemmas val lemma_to_of_uint (n:pos) (u:uint_t n) : Lemma (ensures to_uint n (of_uint n u) == u) [SMTPat (to_uint n (of_uint n u))] val of_nat (x:nat) : poly // TODO: of_uint should accept n = 0 let of_uint_ (n:nat) (u:uint_t n) : poly = if n = 0 then zero else of_uint n u val lemma_of_nat_of_uint (n:nat) (x:nat) : Lemma (requires x < pow2 n) (ensures of_nat x == of_uint_ n x) let rec poly_nat_eq_rec (len:nat) (p:poly) (c:nat) (n:nat) : bool = if n = 0 then c = 0 else (c % 2 = (if p.[len - n] then 1 else 0)) && poly_nat_eq_rec len p (c / 2) (n - 1) // Useful for proving variable p equivalent to constant c via normalization // (c and len should be constant integers) val lemma_to_nat (len:nat) (p:poly) (c:nat) : Lemma (requires degree p < len /\ normalize (poly_nat_eq_rec len p c len)) (ensures p == of_nat c) val of_nat32 (n:nat32) : p:poly{degree p < 32 /\ p == of_nat n} val of_nat32_zero : _:unit{of_nat32 0 == zero} val of_nat32_ones : _:unit{of_nat32 0xffffffff == ones 32} val of_nat32_eq (a b:nat32) : Lemma (requires of_nat32 a == of_nat32 b) (ensures a == b) val of_nat32_xor (a b:nat32) : Lemma (of_nat32 a +. of_nat32 b == of_nat32 (ixor a b)) val of_nat32_and (a b:nat32) : Lemma (poly_and (of_nat32 a) (of_nat32 b) == of_nat32 (iand a b)) let poly128_of_poly32s (a0 a1 a2 a3:poly) : poly = a0 +. shift a1 32 +. shift a2 64 +. shift a3 96
{ "checked_file": "/", "dependencies": [ "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Lemmas.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Math.Poly2.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.UInt.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.Math.Poly2.Bits.fsti" }
[ { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": 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
a0: Vale.Def.Types_s.nat32 -> a1: Vale.Def.Types_s.nat32 -> a2: Vale.Def.Types_s.nat32 -> a3: Vale.Def.Types_s.nat32 -> Vale.Math.Poly2_s.poly
Prims.Tot
[ "total" ]
[]
[ "Vale.Def.Types_s.nat32", "Vale.Math.Poly2.Bits.poly128_of_poly32s", "Vale.Math.Poly2.Bits.of_nat32", "Vale.Math.Poly2_s.poly" ]
[]
false
false
false
true
false
let poly128_of_nat32s (a0 a1 a2 a3: nat32) : poly =
poly128_of_poly32s (of_nat32 a0) (of_nat32 a1) (of_nat32 a2) (of_nat32 a3)
false
Lib.NatMod.fsti
Lib.NatMod.inv_mod
val inv_mod (#m: pos{1 < m}) (a: nat_mod m) : nat_mod m
val inv_mod (#m: pos{1 < m}) (a: nat_mod m) : nat_mod m
let inv_mod (#m:pos{1 < m}) (a:nat_mod m) : nat_mod m = pow_mod #m a (m - 2)
{ "file_name": "lib/Lib.NatMod.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 76, "end_line": 114, "start_col": 0, "start_line": 114 }
module Lib.NatMod open FStar.Mul module Fermat = FStar.Math.Fermat module Euclid = FStar.Math.Euclid module LE = Lib.Exponentiation.Definition #set-options "--z3rlimit 10 --fuel 0 --ifuel 0" let mk_nat_comm_monoid : LE.comm_monoid int = { LE.one = 1; LE.mul = FStar.Mul.op_Star; LE.lemma_one = Math.Lemmas.mul_one_right_is_same; LE.lemma_mul_assoc = Math.Lemmas.paren_mul_right; LE.lemma_mul_comm = Math.Lemmas.swap_mul; } let rec pow (x:int) (n:nat) : Tot int = if n = 0 then 1 else x * pow x (n - 1) val lemma_pow0: a:int -> Lemma (pow a 0 = 1) val lemma_pow1: a:int -> Lemma (pow a 1 = a) val lemma_pow_unfold: a:int -> b:pos -> Lemma (a * pow a (b - 1) == pow a b) val lemma_pow_gt_zero: a:pos -> b:nat -> Lemma (pow a b > 0) [SMTPat (pow a b)] val lemma_pow_ge_zero: a:nat -> b:nat -> Lemma (pow a b >= 0) [SMTPat (pow a b)] val lemma_pow_nat_is_pow: a:int -> b:nat -> Lemma (pow a b == LE.pow mk_nat_comm_monoid a b) val lemma_pow_zero: b:pos -> Lemma (pow 0 b = 0) val lemma_pow_one: b:nat -> Lemma (pow 1 b = 1) val lemma_pow_add: x:int -> n:nat -> m:nat -> Lemma (pow x n * pow x m = pow x (n + m)) val lemma_pow_mul: x:int -> n:nat -> m:nat -> Lemma (pow (pow x n) m = pow x (n * m)) val lemma_pow_double: a:int -> b:nat -> Lemma (pow (a * a) b == pow a (b + b)) val lemma_pow_mul_base: a:int -> b:int -> n:nat -> Lemma (pow a n * pow b n == pow (a * b) n) val lemma_pow_mod_base: a:int -> b:nat -> n:pos -> Lemma (pow a b % n == pow (a % n) b % n) let nat_mod (m:pos) = n:nat{n < m} let one_mod (#m:pos) : nat_mod m = 1 % m let mul_mod (#m:pos) (a:nat_mod m) (b:nat_mod m) : nat_mod m = a * b % m let add_mod (#m:pos) (a:nat_mod m) (b:nat_mod m) : nat_mod m = (a + b) % m let sub_mod (#m:pos) (a:nat_mod m) (b:nat_mod m) : nat_mod m = (a - b) % m val lemma_mul_mod_one: #m:pos -> a:nat_mod m -> Lemma (mul_mod a one_mod == a) val lemma_mul_mod_assoc: #m:pos -> a:nat_mod m -> b:nat_mod m -> c:nat_mod m -> Lemma (mul_mod (mul_mod a b) c == mul_mod a (mul_mod b c)) val lemma_mul_mod_comm: #m:pos -> a:nat_mod m -> b:nat_mod m -> Lemma (mul_mod a b == mul_mod b a) let mk_nat_mod_comm_monoid (m:pos) : LE.comm_monoid (nat_mod m) = { LE.one = one_mod; LE.mul = mul_mod; LE.lemma_one = lemma_mul_mod_one; LE.lemma_mul_assoc = lemma_mul_mod_assoc; LE.lemma_mul_comm = lemma_mul_mod_comm; } inline_for_extraction let rec pow_mod_ (#m:pos{1 < m}) (a:nat_mod m) (b:nat) : Tot (nat_mod m) (decreases b) = if b = 0 then 1 else if b % 2 = 0 then pow_mod_ (mul_mod a a) (b / 2) else mul_mod a (pow_mod_ (mul_mod a a) (b / 2)) val pow_mod: #m:pos{1 < m} -> a:nat_mod m -> b:nat -> nat_mod m val pow_mod_def: #m:pos{1 < m} -> a:nat_mod m -> b:nat -> Lemma (pow_mod a b == pow_mod_ a b) val lemma_pow_mod: #m:pos{1 < m} -> a:nat_mod m -> b:nat -> Lemma (pow a b % m == pow_mod #m a b) val lemma_pow_nat_mod_is_pow: #n:pos{1 < n} -> a:nat_mod n -> b:nat -> Lemma (pow a b % n == LE.pow (mk_nat_mod_comm_monoid n) a b) val lemma_add_mod_one: #m:pos -> a:nat_mod m -> Lemma (add_mod a 0 == a) val lemma_add_mod_assoc: #m:pos -> a:nat_mod m -> b:nat_mod m -> c:nat_mod m -> Lemma (add_mod (add_mod a b) c == add_mod a (add_mod b c)) val lemma_add_mod_comm: #m:pos -> a:nat_mod m -> b:nat_mod m -> Lemma (add_mod a b == add_mod b a) val lemma_mod_distributivity_add_right: #m:pos -> a:nat_mod m -> b:nat_mod m -> c:nat_mod m -> Lemma (mul_mod a (add_mod b c) == add_mod (mul_mod a b) (mul_mod a c)) val lemma_mod_distributivity_add_left: #m:pos -> a:nat_mod m -> b:nat_mod m -> c:nat_mod m -> Lemma (mul_mod (add_mod a b) c == add_mod (mul_mod a c) (mul_mod b c)) val lemma_mod_distributivity_sub_right: #m:pos -> a:nat_mod m -> b:nat_mod m -> c:nat_mod m -> Lemma (mul_mod a (sub_mod b c) == sub_mod (mul_mod a b) (mul_mod a c)) val lemma_mod_distributivity_sub_left: #m:pos -> a:nat_mod m -> b:nat_mod m -> c:nat_mod m -> Lemma (mul_mod (sub_mod a b) c == sub_mod (mul_mod a c) (mul_mod b c))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "Lib.Exponentiation.Definition.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Math.Fermat.fsti.checked", "FStar.Math.Euclid.fsti.checked" ], "interface_file": false, "source_file": "Lib.NatMod.fsti" }
[ { "abbrev": true, "full_module": "Lib.Exponentiation.Definition", "short_module": "LE" }, { "abbrev": true, "full_module": "FStar.Math.Euclid", "short_module": "Euclid" }, { "abbrev": true, "full_module": "FStar.Math.Fermat", "short_module": "Fermat" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "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": 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": 10, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Lib.NatMod.nat_mod m -> Lib.NatMod.nat_mod m
Prims.Tot
[ "total" ]
[]
[ "Prims.pos", "Prims.b2t", "Prims.op_LessThan", "Lib.NatMod.nat_mod", "Lib.NatMod.pow_mod", "Prims.op_Subtraction" ]
[]
false
false
false
false
false
let inv_mod (#m: pos{1 < m}) (a: nat_mod m) : nat_mod m =
pow_mod #m a (m - 2)
false
FStar.Monotonic.Heap.fsti
FStar.Monotonic.Heap.only
val only (#a: Type0) (#rel: preorder a) (x: mref a rel) : GTot (set nat)
val only (#a: Type0) (#rel: preorder a) (x: mref a rel) : GTot (set nat)
let only (#a:Type0) (#rel:preorder a) (x:mref a rel) :GTot (set nat) = S.singleton (addr_of x)
{ "file_name": "ulib/FStar.Monotonic.Heap.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 94, "end_line": 62, "start_col": 0, "start_line": 62 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Monotonic.Heap module S = FStar.Set module TS = FStar.TSet open FStar.Preorder let set = Set.set let tset = TSet.set val heap :Type u#1 val equal: heap -> heap -> Type0 val equal_extensional (h1:heap) (h2:heap) :Lemma (requires True) (ensures (equal h1 h2 <==> h1 == h2)) [SMTPat (equal h1 h2)] val emp :heap val next_addr: heap -> GTot pos val core_mref ([@@@ strictly_positive] a:Type0) : Type0 let mref (a:Type0) (rel:preorder a) : Type0 = core_mref a val addr_of: #a:Type0 -> #rel:preorder a -> mref a rel -> GTot pos val is_mm: #a:Type0 -> #rel:preorder a -> mref a rel -> GTot bool let compare_addrs (#a #b:Type0) (#rel1:preorder a) (#rel2:preorder b) (r1:mref a rel1) (r2:mref b rel2) :GTot bool = addr_of r1 = addr_of r2 val contains: #a:Type0 -> #rel:preorder a -> heap -> mref a rel -> Type0 val addr_unused_in: nat -> heap -> Type0 val not_addr_unused_in_nullptr (h: heap) : Lemma (~ (addr_unused_in 0 h)) val unused_in: #a:Type0 -> #rel:preorder a -> mref a rel -> heap -> Type0 let fresh (#a:Type) (#rel:preorder a) (r:mref a rel) (h0:heap) (h1:heap) = r `unused_in` h0 /\ h1 `contains` r let only_t (#a:Type0) (#rel:preorder a) (x:mref a rel) :GTot (tset nat) = TS.singleton (addr_of x)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.TSet.fsti.checked", "FStar.Set.fsti.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.Monotonic.Heap.fsti" }
[ { "abbrev": true, "full_module": "FStar.FunctionalExtensionality", "short_module": "F" }, { "abbrev": false, "full_module": "FStar.Classical", "short_module": null }, { "abbrev": false, "full_module": "FStar.Preorder", "short_module": null }, { "abbrev": false, "full_module": "FStar.Preorder", "short_module": null }, { "abbrev": true, "full_module": "FStar.TSet", "short_module": "TS" }, { "abbrev": true, "full_module": "FStar.Set", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Monotonic", "short_module": null }, { "abbrev": false, "full_module": "FStar.Monotonic", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: FStar.Monotonic.Heap.mref a rel -> Prims.GTot (FStar.Monotonic.Heap.set Prims.nat)
Prims.GTot
[ "sometrivial" ]
[]
[ "FStar.Preorder.preorder", "FStar.Monotonic.Heap.mref", "FStar.Set.singleton", "Prims.nat", "FStar.Monotonic.Heap.addr_of", "FStar.Monotonic.Heap.set" ]
[]
false
false
false
false
false
let only (#a: Type0) (#rel: preorder a) (x: mref a rel) : GTot (set nat) =
S.singleton (addr_of x)
false
Vale.Math.Poly2.Bits.fsti
Vale.Math.Poly2.Bits.poly128_of_poly32s
val poly128_of_poly32s (a0 a1 a2 a3: poly) : poly
val poly128_of_poly32s (a0 a1 a2 a3: poly) : poly
let poly128_of_poly32s (a0 a1 a2 a3:poly) : poly = a0 +. shift a1 32 +. shift a2 64 +. shift a3 96
{ "file_name": "vale/code/lib/math/Vale.Math.Poly2.Bits.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 49, "end_line": 56, "start_col": 0, "start_line": 55 }
module Vale.Math.Poly2.Bits open FStar.Mul open Vale.Def.Words_s open Vale.Def.Types_s open FStar.UInt open FStar.Seq open Vale.Arch.Types open Vale.Math.Poly2_s open Vale.Math.Poly2.Bits_s open Vale.Math.Poly2 open Vale.Math.Poly2.Lemmas val lemma_to_of_uint (n:pos) (u:uint_t n) : Lemma (ensures to_uint n (of_uint n u) == u) [SMTPat (to_uint n (of_uint n u))] val of_nat (x:nat) : poly // TODO: of_uint should accept n = 0 let of_uint_ (n:nat) (u:uint_t n) : poly = if n = 0 then zero else of_uint n u val lemma_of_nat_of_uint (n:nat) (x:nat) : Lemma (requires x < pow2 n) (ensures of_nat x == of_uint_ n x) let rec poly_nat_eq_rec (len:nat) (p:poly) (c:nat) (n:nat) : bool = if n = 0 then c = 0 else (c % 2 = (if p.[len - n] then 1 else 0)) && poly_nat_eq_rec len p (c / 2) (n - 1) // Useful for proving variable p equivalent to constant c via normalization // (c and len should be constant integers) val lemma_to_nat (len:nat) (p:poly) (c:nat) : Lemma (requires degree p < len /\ normalize (poly_nat_eq_rec len p c len)) (ensures p == of_nat c) val of_nat32 (n:nat32) : p:poly{degree p < 32 /\ p == of_nat n} val of_nat32_zero : _:unit{of_nat32 0 == zero} val of_nat32_ones : _:unit{of_nat32 0xffffffff == ones 32} val of_nat32_eq (a b:nat32) : Lemma (requires of_nat32 a == of_nat32 b) (ensures a == b) val of_nat32_xor (a b:nat32) : Lemma (of_nat32 a +. of_nat32 b == of_nat32 (ixor a b)) val of_nat32_and (a b:nat32) : Lemma (poly_and (of_nat32 a) (of_nat32 b) == of_nat32 (iand a b))
{ "checked_file": "/", "dependencies": [ "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Lemmas.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Math.Poly2.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.UInt.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.Math.Poly2.Bits.fsti" }
[ { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": 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
a0: Vale.Math.Poly2_s.poly -> a1: Vale.Math.Poly2_s.poly -> a2: Vale.Math.Poly2_s.poly -> a3: Vale.Math.Poly2_s.poly -> Vale.Math.Poly2_s.poly
Prims.Tot
[ "total" ]
[]
[ "Vale.Math.Poly2_s.poly", "Vale.Math.Poly2.op_Plus_Dot", "Vale.Math.Poly2_s.shift" ]
[]
false
false
false
true
false
let poly128_of_poly32s (a0 a1 a2 a3: poly) : poly =
a0 +. shift a1 32 +. shift a2 64 +. shift a3 96
false
FStar.Monotonic.Heap.fsti
FStar.Monotonic.Heap.op_Hat_Plus_Hat
val ( ^+^ ) (#a #b: Type0) (#rel1: preorder a) (#rel2: preorder b) (r1: mref a rel1) (r2: mref b rel2) : GTot (set nat)
val ( ^+^ ) (#a #b: Type0) (#rel1: preorder a) (#rel2: preorder b) (r1: mref a rel1) (r2: mref b rel2) : GTot (set nat)
let op_Hat_Plus_Hat (#a:Type0) (#b:Type0) (#rel1:preorder a) (#rel2:preorder b) (r1:mref a rel1) (r2:mref b rel2) :GTot (set nat) = S.union (only r1) (only r2)
{ "file_name": "ulib/FStar.Monotonic.Heap.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 47, "end_line": 69, "start_col": 0, "start_line": 68 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Monotonic.Heap module S = FStar.Set module TS = FStar.TSet open FStar.Preorder let set = Set.set let tset = TSet.set val heap :Type u#1 val equal: heap -> heap -> Type0 val equal_extensional (h1:heap) (h2:heap) :Lemma (requires True) (ensures (equal h1 h2 <==> h1 == h2)) [SMTPat (equal h1 h2)] val emp :heap val next_addr: heap -> GTot pos val core_mref ([@@@ strictly_positive] a:Type0) : Type0 let mref (a:Type0) (rel:preorder a) : Type0 = core_mref a val addr_of: #a:Type0 -> #rel:preorder a -> mref a rel -> GTot pos val is_mm: #a:Type0 -> #rel:preorder a -> mref a rel -> GTot bool let compare_addrs (#a #b:Type0) (#rel1:preorder a) (#rel2:preorder b) (r1:mref a rel1) (r2:mref b rel2) :GTot bool = addr_of r1 = addr_of r2 val contains: #a:Type0 -> #rel:preorder a -> heap -> mref a rel -> Type0 val addr_unused_in: nat -> heap -> Type0 val not_addr_unused_in_nullptr (h: heap) : Lemma (~ (addr_unused_in 0 h)) val unused_in: #a:Type0 -> #rel:preorder a -> mref a rel -> heap -> Type0 let fresh (#a:Type) (#rel:preorder a) (r:mref a rel) (h0:heap) (h1:heap) = r `unused_in` h0 /\ h1 `contains` r let only_t (#a:Type0) (#rel:preorder a) (x:mref a rel) :GTot (tset nat) = TS.singleton (addr_of x) let only (#a:Type0) (#rel:preorder a) (x:mref a rel) :GTot (set nat) = S.singleton (addr_of x) let op_Hat_Plus_Plus (#a:Type0) (#rel:preorder a) (r:mref a rel) (s:set nat) :GTot (set nat) = S.union (only r) s let op_Plus_Plus_Hat (#a:Type0) (#rel:preorder a) (s:set nat) (r:mref a rel) :GTot (set nat) = S.union s (only r)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.TSet.fsti.checked", "FStar.Set.fsti.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.Monotonic.Heap.fsti" }
[ { "abbrev": true, "full_module": "FStar.FunctionalExtensionality", "short_module": "F" }, { "abbrev": false, "full_module": "FStar.Classical", "short_module": null }, { "abbrev": false, "full_module": "FStar.Preorder", "short_module": null }, { "abbrev": false, "full_module": "FStar.Preorder", "short_module": null }, { "abbrev": true, "full_module": "FStar.TSet", "short_module": "TS" }, { "abbrev": true, "full_module": "FStar.Set", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Monotonic", "short_module": null }, { "abbrev": false, "full_module": "FStar.Monotonic", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
r1: FStar.Monotonic.Heap.mref a rel1 -> r2: FStar.Monotonic.Heap.mref b rel2 -> Prims.GTot (FStar.Monotonic.Heap.set Prims.nat)
Prims.GTot
[ "sometrivial" ]
[]
[ "FStar.Preorder.preorder", "FStar.Monotonic.Heap.mref", "FStar.Set.union", "Prims.nat", "FStar.Monotonic.Heap.only", "FStar.Monotonic.Heap.set" ]
[]
false
false
false
false
false
let ( ^+^ ) (#a #b: Type0) (#rel1: preorder a) (#rel2: preorder b) (r1: mref a rel1) (r2: mref b rel2) : GTot (set nat) =
S.union (only r1) (only r2)
false
FStar.Monotonic.Heap.fsti
FStar.Monotonic.Heap.only_t
val only_t (#a: Type0) (#rel: preorder a) (x: mref a rel) : GTot (tset nat)
val only_t (#a: Type0) (#rel: preorder a) (x: mref a rel) : GTot (tset nat)
let only_t (#a:Type0) (#rel:preorder a) (x:mref a rel) :GTot (tset nat) = TS.singleton (addr_of x)
{ "file_name": "ulib/FStar.Monotonic.Heap.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 98, "end_line": 60, "start_col": 0, "start_line": 60 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Monotonic.Heap module S = FStar.Set module TS = FStar.TSet open FStar.Preorder let set = Set.set let tset = TSet.set val heap :Type u#1 val equal: heap -> heap -> Type0 val equal_extensional (h1:heap) (h2:heap) :Lemma (requires True) (ensures (equal h1 h2 <==> h1 == h2)) [SMTPat (equal h1 h2)] val emp :heap val next_addr: heap -> GTot pos val core_mref ([@@@ strictly_positive] a:Type0) : Type0 let mref (a:Type0) (rel:preorder a) : Type0 = core_mref a val addr_of: #a:Type0 -> #rel:preorder a -> mref a rel -> GTot pos val is_mm: #a:Type0 -> #rel:preorder a -> mref a rel -> GTot bool let compare_addrs (#a #b:Type0) (#rel1:preorder a) (#rel2:preorder b) (r1:mref a rel1) (r2:mref b rel2) :GTot bool = addr_of r1 = addr_of r2 val contains: #a:Type0 -> #rel:preorder a -> heap -> mref a rel -> Type0 val addr_unused_in: nat -> heap -> Type0 val not_addr_unused_in_nullptr (h: heap) : Lemma (~ (addr_unused_in 0 h)) val unused_in: #a:Type0 -> #rel:preorder a -> mref a rel -> heap -> Type0 let fresh (#a:Type) (#rel:preorder a) (r:mref a rel) (h0:heap) (h1:heap) = r `unused_in` h0 /\ h1 `contains` r
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.TSet.fsti.checked", "FStar.Set.fsti.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.Monotonic.Heap.fsti" }
[ { "abbrev": true, "full_module": "FStar.FunctionalExtensionality", "short_module": "F" }, { "abbrev": false, "full_module": "FStar.Classical", "short_module": null }, { "abbrev": false, "full_module": "FStar.Preorder", "short_module": null }, { "abbrev": false, "full_module": "FStar.Preorder", "short_module": null }, { "abbrev": true, "full_module": "FStar.TSet", "short_module": "TS" }, { "abbrev": true, "full_module": "FStar.Set", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Monotonic", "short_module": null }, { "abbrev": false, "full_module": "FStar.Monotonic", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: FStar.Monotonic.Heap.mref a rel -> Prims.GTot (FStar.Monotonic.Heap.tset Prims.nat)
Prims.GTot
[ "sometrivial" ]
[]
[ "FStar.Preorder.preorder", "FStar.Monotonic.Heap.mref", "FStar.TSet.singleton", "Prims.nat", "FStar.Monotonic.Heap.addr_of", "FStar.Monotonic.Heap.tset" ]
[]
false
false
false
false
false
let only_t (#a: Type0) (#rel: preorder a) (x: mref a rel) : GTot (tset nat) =
TS.singleton (addr_of x)
false
FStar.Monotonic.Heap.fsti
FStar.Monotonic.Heap.modifies
val modifies : s: FStar.Monotonic.Heap.set Prims.nat -> h0: FStar.Monotonic.Heap.heap -> h1: FStar.Monotonic.Heap.heap -> Prims.logical
let modifies (s:set nat) (h0:heap) (h1:heap) = modifies_t (TS.tset_of_set s) h0 h1
{ "file_name": "ulib/FStar.Monotonic.Heap.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 82, "end_line": 95, "start_col": 0, "start_line": 95 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Monotonic.Heap module S = FStar.Set module TS = FStar.TSet open FStar.Preorder let set = Set.set let tset = TSet.set val heap :Type u#1 val equal: heap -> heap -> Type0 val equal_extensional (h1:heap) (h2:heap) :Lemma (requires True) (ensures (equal h1 h2 <==> h1 == h2)) [SMTPat (equal h1 h2)] val emp :heap val next_addr: heap -> GTot pos val core_mref ([@@@ strictly_positive] a:Type0) : Type0 let mref (a:Type0) (rel:preorder a) : Type0 = core_mref a val addr_of: #a:Type0 -> #rel:preorder a -> mref a rel -> GTot pos val is_mm: #a:Type0 -> #rel:preorder a -> mref a rel -> GTot bool let compare_addrs (#a #b:Type0) (#rel1:preorder a) (#rel2:preorder b) (r1:mref a rel1) (r2:mref b rel2) :GTot bool = addr_of r1 = addr_of r2 val contains: #a:Type0 -> #rel:preorder a -> heap -> mref a rel -> Type0 val addr_unused_in: nat -> heap -> Type0 val not_addr_unused_in_nullptr (h: heap) : Lemma (~ (addr_unused_in 0 h)) val unused_in: #a:Type0 -> #rel:preorder a -> mref a rel -> heap -> Type0 let fresh (#a:Type) (#rel:preorder a) (r:mref a rel) (h0:heap) (h1:heap) = r `unused_in` h0 /\ h1 `contains` r let only_t (#a:Type0) (#rel:preorder a) (x:mref a rel) :GTot (tset nat) = TS.singleton (addr_of x) let only (#a:Type0) (#rel:preorder a) (x:mref a rel) :GTot (set nat) = S.singleton (addr_of x) let op_Hat_Plus_Plus (#a:Type0) (#rel:preorder a) (r:mref a rel) (s:set nat) :GTot (set nat) = S.union (only r) s let op_Plus_Plus_Hat (#a:Type0) (#rel:preorder a) (s:set nat) (r:mref a rel) :GTot (set nat) = S.union s (only r) let op_Hat_Plus_Hat (#a:Type0) (#b:Type0) (#rel1:preorder a) (#rel2:preorder b) (r1:mref a rel1) (r2:mref b rel2) :GTot (set nat) = S.union (only r1) (only r2) val sel_tot: #a:Type0 -> #rel:preorder a -> h:heap -> r:mref a rel{h `contains` r} -> Tot a val sel: #a:Type0 -> #rel:preorder a -> heap -> mref a rel -> GTot a val upd_tot: #a:Type0 -> #rel:preorder a -> h:heap -> r:mref a rel{h `contains` r} -> x:a -> Tot heap val upd: #a:Type0 -> #rel:preorder a -> h:heap -> r:mref a rel -> x:a -> GTot heap val alloc: #a:Type0 -> rel:preorder a -> heap -> a -> mm:bool -> Tot (mref a rel * heap) val free_mm: #a:Type0 -> #rel:preorder a -> h:heap -> r:mref a rel{h `contains` r /\ is_mm r} -> Tot heap let modifies_t (s:tset nat) (h0:heap) (h1:heap) = (forall (a:Type) (rel:preorder a) (r:mref a rel).{:pattern (sel h1 r)} ((~ (TS.mem (addr_of r) s)) /\ h0 `contains` r) ==> sel h1 r == sel h0 r) /\ (forall (a:Type) (rel:preorder a) (r:mref a rel).{:pattern (contains h1 r)} h0 `contains` r ==> h1 `contains` r) /\ (forall (a:Type) (rel:preorder a) (r:mref a rel).{:pattern (r `unused_in` h0)} r `unused_in` h1 ==> r `unused_in` h0) /\ (forall (n: nat) . {:pattern (n `addr_unused_in` h0) } n `addr_unused_in` h1 ==> n `addr_unused_in` h0 )
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.TSet.fsti.checked", "FStar.Set.fsti.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.Monotonic.Heap.fsti" }
[ { "abbrev": true, "full_module": "FStar.FunctionalExtensionality", "short_module": "F" }, { "abbrev": false, "full_module": "FStar.Classical", "short_module": null }, { "abbrev": false, "full_module": "FStar.Preorder", "short_module": null }, { "abbrev": false, "full_module": "FStar.Preorder", "short_module": null }, { "abbrev": true, "full_module": "FStar.TSet", "short_module": "TS" }, { "abbrev": true, "full_module": "FStar.Set", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Monotonic", "short_module": null }, { "abbrev": false, "full_module": "FStar.Monotonic", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
s: FStar.Monotonic.Heap.set Prims.nat -> h0: FStar.Monotonic.Heap.heap -> h1: FStar.Monotonic.Heap.heap -> Prims.logical
Prims.Tot
[ "total" ]
[]
[ "FStar.Monotonic.Heap.set", "Prims.nat", "FStar.Monotonic.Heap.heap", "FStar.Monotonic.Heap.modifies_t", "FStar.TSet.tset_of_set", "Prims.logical" ]
[]
false
false
false
true
true
let modifies (s: set nat) (h0 h1: heap) =
modifies_t (TS.tset_of_set s) h0 h1
false
FStar.Monotonic.Heap.fsti
FStar.Monotonic.Heap.op_Plus_Plus_Hat
val ( ++^ ) (#a: Type0) (#rel: preorder a) (s: set nat) (r: mref a rel) : GTot (set nat)
val ( ++^ ) (#a: Type0) (#rel: preorder a) (s: set nat) (r: mref a rel) : GTot (set nat)
let op_Plus_Plus_Hat (#a:Type0) (#rel:preorder a) (s:set nat) (r:mref a rel) :GTot (set nat) = S.union s (only r)
{ "file_name": "ulib/FStar.Monotonic.Heap.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 113, "end_line": 66, "start_col": 0, "start_line": 66 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Monotonic.Heap module S = FStar.Set module TS = FStar.TSet open FStar.Preorder let set = Set.set let tset = TSet.set val heap :Type u#1 val equal: heap -> heap -> Type0 val equal_extensional (h1:heap) (h2:heap) :Lemma (requires True) (ensures (equal h1 h2 <==> h1 == h2)) [SMTPat (equal h1 h2)] val emp :heap val next_addr: heap -> GTot pos val core_mref ([@@@ strictly_positive] a:Type0) : Type0 let mref (a:Type0) (rel:preorder a) : Type0 = core_mref a val addr_of: #a:Type0 -> #rel:preorder a -> mref a rel -> GTot pos val is_mm: #a:Type0 -> #rel:preorder a -> mref a rel -> GTot bool let compare_addrs (#a #b:Type0) (#rel1:preorder a) (#rel2:preorder b) (r1:mref a rel1) (r2:mref b rel2) :GTot bool = addr_of r1 = addr_of r2 val contains: #a:Type0 -> #rel:preorder a -> heap -> mref a rel -> Type0 val addr_unused_in: nat -> heap -> Type0 val not_addr_unused_in_nullptr (h: heap) : Lemma (~ (addr_unused_in 0 h)) val unused_in: #a:Type0 -> #rel:preorder a -> mref a rel -> heap -> Type0 let fresh (#a:Type) (#rel:preorder a) (r:mref a rel) (h0:heap) (h1:heap) = r `unused_in` h0 /\ h1 `contains` r let only_t (#a:Type0) (#rel:preorder a) (x:mref a rel) :GTot (tset nat) = TS.singleton (addr_of x) let only (#a:Type0) (#rel:preorder a) (x:mref a rel) :GTot (set nat) = S.singleton (addr_of x) let op_Hat_Plus_Plus (#a:Type0) (#rel:preorder a) (r:mref a rel) (s:set nat) :GTot (set nat) = S.union (only r) s
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.TSet.fsti.checked", "FStar.Set.fsti.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.Monotonic.Heap.fsti" }
[ { "abbrev": true, "full_module": "FStar.FunctionalExtensionality", "short_module": "F" }, { "abbrev": false, "full_module": "FStar.Classical", "short_module": null }, { "abbrev": false, "full_module": "FStar.Preorder", "short_module": null }, { "abbrev": false, "full_module": "FStar.Preorder", "short_module": null }, { "abbrev": true, "full_module": "FStar.TSet", "short_module": "TS" }, { "abbrev": true, "full_module": "FStar.Set", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Monotonic", "short_module": null }, { "abbrev": false, "full_module": "FStar.Monotonic", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
s: FStar.Monotonic.Heap.set Prims.nat -> r: FStar.Monotonic.Heap.mref a rel -> Prims.GTot (FStar.Monotonic.Heap.set Prims.nat)
Prims.GTot
[ "sometrivial" ]
[]
[ "FStar.Preorder.preorder", "FStar.Monotonic.Heap.set", "Prims.nat", "FStar.Monotonic.Heap.mref", "FStar.Set.union", "FStar.Monotonic.Heap.only" ]
[]
false
false
false
false
false
let ( ++^ ) (#a: Type0) (#rel: preorder a) (s: set nat) (r: mref a rel) : GTot (set nat) =
S.union s (only r)
false
FStar.Monotonic.Heap.fsti
FStar.Monotonic.Heap.op_Hat_Plus_Plus
val ( ^++ ) (#a: Type0) (#rel: preorder a) (r: mref a rel) (s: set nat) : GTot (set nat)
val ( ^++ ) (#a: Type0) (#rel: preorder a) (r: mref a rel) (s: set nat) : GTot (set nat)
let op_Hat_Plus_Plus (#a:Type0) (#rel:preorder a) (r:mref a rel) (s:set nat) :GTot (set nat) = S.union (only r) s
{ "file_name": "ulib/FStar.Monotonic.Heap.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 113, "end_line": 64, "start_col": 0, "start_line": 64 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Monotonic.Heap module S = FStar.Set module TS = FStar.TSet open FStar.Preorder let set = Set.set let tset = TSet.set val heap :Type u#1 val equal: heap -> heap -> Type0 val equal_extensional (h1:heap) (h2:heap) :Lemma (requires True) (ensures (equal h1 h2 <==> h1 == h2)) [SMTPat (equal h1 h2)] val emp :heap val next_addr: heap -> GTot pos val core_mref ([@@@ strictly_positive] a:Type0) : Type0 let mref (a:Type0) (rel:preorder a) : Type0 = core_mref a val addr_of: #a:Type0 -> #rel:preorder a -> mref a rel -> GTot pos val is_mm: #a:Type0 -> #rel:preorder a -> mref a rel -> GTot bool let compare_addrs (#a #b:Type0) (#rel1:preorder a) (#rel2:preorder b) (r1:mref a rel1) (r2:mref b rel2) :GTot bool = addr_of r1 = addr_of r2 val contains: #a:Type0 -> #rel:preorder a -> heap -> mref a rel -> Type0 val addr_unused_in: nat -> heap -> Type0 val not_addr_unused_in_nullptr (h: heap) : Lemma (~ (addr_unused_in 0 h)) val unused_in: #a:Type0 -> #rel:preorder a -> mref a rel -> heap -> Type0 let fresh (#a:Type) (#rel:preorder a) (r:mref a rel) (h0:heap) (h1:heap) = r `unused_in` h0 /\ h1 `contains` r let only_t (#a:Type0) (#rel:preorder a) (x:mref a rel) :GTot (tset nat) = TS.singleton (addr_of x) let only (#a:Type0) (#rel:preorder a) (x:mref a rel) :GTot (set nat) = S.singleton (addr_of x)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.TSet.fsti.checked", "FStar.Set.fsti.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.Monotonic.Heap.fsti" }
[ { "abbrev": true, "full_module": "FStar.FunctionalExtensionality", "short_module": "F" }, { "abbrev": false, "full_module": "FStar.Classical", "short_module": null }, { "abbrev": false, "full_module": "FStar.Preorder", "short_module": null }, { "abbrev": false, "full_module": "FStar.Preorder", "short_module": null }, { "abbrev": true, "full_module": "FStar.TSet", "short_module": "TS" }, { "abbrev": true, "full_module": "FStar.Set", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Monotonic", "short_module": null }, { "abbrev": false, "full_module": "FStar.Monotonic", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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.Monotonic.Heap.mref a rel -> s: FStar.Monotonic.Heap.set Prims.nat -> Prims.GTot (FStar.Monotonic.Heap.set Prims.nat)
Prims.GTot
[ "sometrivial" ]
[]
[ "FStar.Preorder.preorder", "FStar.Monotonic.Heap.mref", "FStar.Monotonic.Heap.set", "Prims.nat", "FStar.Set.union", "FStar.Monotonic.Heap.only" ]
[]
false
false
false
false
false
let ( ^++ ) (#a: Type0) (#rel: preorder a) (r: mref a rel) (s: set nat) : GTot (set nat) =
S.union (only r) s
false
FStar.Monotonic.Heap.fsti
FStar.Monotonic.Heap.modifies_t
val modifies_t : s: FStar.Monotonic.Heap.tset Prims.nat -> h0: FStar.Monotonic.Heap.heap -> h1: FStar.Monotonic.Heap.heap -> Prims.logical
let modifies_t (s:tset nat) (h0:heap) (h1:heap) = (forall (a:Type) (rel:preorder a) (r:mref a rel).{:pattern (sel h1 r)} ((~ (TS.mem (addr_of r) s)) /\ h0 `contains` r) ==> sel h1 r == sel h0 r) /\ (forall (a:Type) (rel:preorder a) (r:mref a rel).{:pattern (contains h1 r)} h0 `contains` r ==> h1 `contains` r) /\ (forall (a:Type) (rel:preorder a) (r:mref a rel).{:pattern (r `unused_in` h0)} r `unused_in` h1 ==> r `unused_in` h0) /\ (forall (n: nat) . {:pattern (n `addr_unused_in` h0) } n `addr_unused_in` h1 ==> n `addr_unused_in` h0 )
{ "file_name": "ulib/FStar.Monotonic.Heap.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 3, "end_line": 92, "start_col": 0, "start_line": 83 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.Monotonic.Heap module S = FStar.Set module TS = FStar.TSet open FStar.Preorder let set = Set.set let tset = TSet.set val heap :Type u#1 val equal: heap -> heap -> Type0 val equal_extensional (h1:heap) (h2:heap) :Lemma (requires True) (ensures (equal h1 h2 <==> h1 == h2)) [SMTPat (equal h1 h2)] val emp :heap val next_addr: heap -> GTot pos val core_mref ([@@@ strictly_positive] a:Type0) : Type0 let mref (a:Type0) (rel:preorder a) : Type0 = core_mref a val addr_of: #a:Type0 -> #rel:preorder a -> mref a rel -> GTot pos val is_mm: #a:Type0 -> #rel:preorder a -> mref a rel -> GTot bool let compare_addrs (#a #b:Type0) (#rel1:preorder a) (#rel2:preorder b) (r1:mref a rel1) (r2:mref b rel2) :GTot bool = addr_of r1 = addr_of r2 val contains: #a:Type0 -> #rel:preorder a -> heap -> mref a rel -> Type0 val addr_unused_in: nat -> heap -> Type0 val not_addr_unused_in_nullptr (h: heap) : Lemma (~ (addr_unused_in 0 h)) val unused_in: #a:Type0 -> #rel:preorder a -> mref a rel -> heap -> Type0 let fresh (#a:Type) (#rel:preorder a) (r:mref a rel) (h0:heap) (h1:heap) = r `unused_in` h0 /\ h1 `contains` r let only_t (#a:Type0) (#rel:preorder a) (x:mref a rel) :GTot (tset nat) = TS.singleton (addr_of x) let only (#a:Type0) (#rel:preorder a) (x:mref a rel) :GTot (set nat) = S.singleton (addr_of x) let op_Hat_Plus_Plus (#a:Type0) (#rel:preorder a) (r:mref a rel) (s:set nat) :GTot (set nat) = S.union (only r) s let op_Plus_Plus_Hat (#a:Type0) (#rel:preorder a) (s:set nat) (r:mref a rel) :GTot (set nat) = S.union s (only r) let op_Hat_Plus_Hat (#a:Type0) (#b:Type0) (#rel1:preorder a) (#rel2:preorder b) (r1:mref a rel1) (r2:mref b rel2) :GTot (set nat) = S.union (only r1) (only r2) val sel_tot: #a:Type0 -> #rel:preorder a -> h:heap -> r:mref a rel{h `contains` r} -> Tot a val sel: #a:Type0 -> #rel:preorder a -> heap -> mref a rel -> GTot a val upd_tot: #a:Type0 -> #rel:preorder a -> h:heap -> r:mref a rel{h `contains` r} -> x:a -> Tot heap val upd: #a:Type0 -> #rel:preorder a -> h:heap -> r:mref a rel -> x:a -> GTot heap val alloc: #a:Type0 -> rel:preorder a -> heap -> a -> mm:bool -> Tot (mref a rel * heap) val free_mm: #a:Type0 -> #rel:preorder a -> h:heap -> r:mref a rel{h `contains` r /\ is_mm r} -> Tot heap
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.TSet.fsti.checked", "FStar.Set.fsti.checked", "FStar.Preorder.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.Monotonic.Heap.fsti" }
[ { "abbrev": true, "full_module": "FStar.FunctionalExtensionality", "short_module": "F" }, { "abbrev": false, "full_module": "FStar.Classical", "short_module": null }, { "abbrev": false, "full_module": "FStar.Preorder", "short_module": null }, { "abbrev": false, "full_module": "FStar.Preorder", "short_module": null }, { "abbrev": true, "full_module": "FStar.TSet", "short_module": "TS" }, { "abbrev": true, "full_module": "FStar.Set", "short_module": "S" }, { "abbrev": false, "full_module": "FStar.Monotonic", "short_module": null }, { "abbrev": false, "full_module": "FStar.Monotonic", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
s: FStar.Monotonic.Heap.tset Prims.nat -> h0: FStar.Monotonic.Heap.heap -> h1: FStar.Monotonic.Heap.heap -> Prims.logical
Prims.Tot
[ "total" ]
[]
[ "FStar.Monotonic.Heap.tset", "Prims.nat", "FStar.Monotonic.Heap.heap", "Prims.l_and", "Prims.l_Forall", "FStar.Preorder.preorder", "FStar.Monotonic.Heap.mref", "Prims.l_imp", "Prims.l_not", "FStar.TSet.mem", "FStar.Monotonic.Heap.addr_of", "FStar.Monotonic.Heap.contains", "Prims.eq2", "FStar.Monotonic.Heap.sel", "FStar.Monotonic.Heap.unused_in", "FStar.Monotonic.Heap.addr_unused_in", "Prims.logical" ]
[]
false
false
false
true
true
let modifies_t (s: tset nat) (h0 h1: heap) =
(forall (a: Type) (rel: preorder a) (r: mref a rel). {:pattern (sel h1 r)} ((~(TS.mem (addr_of r) s)) /\ h0 `contains` r) ==> sel h1 r == sel h0 r) /\ (forall (a: Type) (rel: preorder a) (r: mref a rel). {:pattern (contains h1 r)} h0 `contains` r ==> h1 `contains` r) /\ (forall (a: Type) (rel: preorder a) (r: mref a rel). {:pattern (r `unused_in` h0)} r `unused_in` h1 ==> r `unused_in` h0) /\ (forall (n: nat). {:pattern (n `addr_unused_in` h0)} n `addr_unused_in` h1 ==> n `addr_unused_in` h0 )
false
Vale.Math.Poly2.Bits.fsti
Vale.Math.Poly2.Bits.of_uint_
val of_uint_ (n: nat) (u: uint_t n) : poly
val of_uint_ (n: nat) (u: uint_t n) : poly
let of_uint_ (n:nat) (u:uint_t n) : poly = if n = 0 then zero else of_uint n u
{ "file_name": "vale/code/lib/math/Vale.Math.Poly2.Bits.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 37, "end_line": 21, "start_col": 0, "start_line": 20 }
module Vale.Math.Poly2.Bits open FStar.Mul open Vale.Def.Words_s open Vale.Def.Types_s open FStar.UInt open FStar.Seq open Vale.Arch.Types open Vale.Math.Poly2_s open Vale.Math.Poly2.Bits_s open Vale.Math.Poly2 open Vale.Math.Poly2.Lemmas val lemma_to_of_uint (n:pos) (u:uint_t n) : Lemma (ensures to_uint n (of_uint n u) == u) [SMTPat (to_uint n (of_uint n u))] val of_nat (x:nat) : poly
{ "checked_file": "/", "dependencies": [ "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Lemmas.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Math.Poly2.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.UInt.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.Math.Poly2.Bits.fsti" }
[ { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": 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
n: Prims.nat -> u8: FStar.UInt.uint_t n -> Vale.Math.Poly2_s.poly
Prims.Tot
[ "total" ]
[]
[ "Prims.nat", "FStar.UInt.uint_t", "Prims.op_Equality", "Prims.int", "Vale.Math.Poly2_s.zero", "Prims.bool", "Vale.Math.Poly2.Bits_s.of_uint", "Vale.Math.Poly2_s.poly" ]
[]
false
false
false
false
false
let of_uint_ (n: nat) (u: uint_t n) : poly =
if n = 0 then zero else of_uint n u
false
Vale.Math.Poly2.Bits.fsti
Vale.Math.Poly2.Bits.poly_nat_eq_rec
val poly_nat_eq_rec (len: nat) (p: poly) (c n: nat) : bool
val poly_nat_eq_rec (len: nat) (p: poly) (c n: nat) : bool
let rec poly_nat_eq_rec (len:nat) (p:poly) (c:nat) (n:nat) : bool = if n = 0 then c = 0 else (c % 2 = (if p.[len - n] then 1 else 0)) && poly_nat_eq_rec len p (c / 2) (n - 1)
{ "file_name": "vale/code/lib/math/Vale.Math.Poly2.Bits.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 41, "end_line": 31, "start_col": 0, "start_line": 27 }
module Vale.Math.Poly2.Bits open FStar.Mul open Vale.Def.Words_s open Vale.Def.Types_s open FStar.UInt open FStar.Seq open Vale.Arch.Types open Vale.Math.Poly2_s open Vale.Math.Poly2.Bits_s open Vale.Math.Poly2 open Vale.Math.Poly2.Lemmas val lemma_to_of_uint (n:pos) (u:uint_t n) : Lemma (ensures to_uint n (of_uint n u) == u) [SMTPat (to_uint n (of_uint n u))] val of_nat (x:nat) : poly // TODO: of_uint should accept n = 0 let of_uint_ (n:nat) (u:uint_t n) : poly = if n = 0 then zero else of_uint n u val lemma_of_nat_of_uint (n:nat) (x:nat) : Lemma (requires x < pow2 n) (ensures of_nat x == of_uint_ n x)
{ "checked_file": "/", "dependencies": [ "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Lemmas.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Math.Poly2.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.Arch.Types.fsti.checked", "prims.fst.checked", "FStar.UInt.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.Math.Poly2.Bits.fsti" }
[ { "abbrev": false, "full_module": "Vale.Math.Poly2.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2.Bits_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Arch.Types", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.UInt", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_s", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "Vale.Math.Poly2", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": 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
len: Prims.nat -> p: Vale.Math.Poly2_s.poly -> c: Prims.nat -> n: Prims.nat -> Prims.bool
Prims.Tot
[ "total" ]
[]
[ "Prims.nat", "Vale.Math.Poly2_s.poly", "Prims.op_Equality", "Prims.int", "Prims.bool", "Prims.op_AmpAmp", "Prims.op_Modulus", "Vale.Math.Poly2_s.op_String_Access", "Prims.op_Subtraction", "Vale.Math.Poly2.Bits.poly_nat_eq_rec", "Prims.op_Division" ]
[ "recursion" ]
false
false
false
true
false
let rec poly_nat_eq_rec (len: nat) (p: poly) (c n: nat) : bool =
if n = 0 then c = 0 else (c % 2 = (if p.[ len - n ] then 1 else 0)) && poly_nat_eq_rec len p (c / 2) (n - 1)
false
Pulse.Main.fst
Pulse.Main.join_smt_goals
val join_smt_goals: Prims.unit -> Tac unit
val join_smt_goals: Prims.unit -> Tac unit
let join_smt_goals () : Tac unit = let open FStar.Tactics.V2 in let open FStar.List.Tot in if RU.debug_at_level (top_env ()) "pulse.join" then dump "PULSE: Goals before join"; (* Join *) let smt_goals = smt_goals () in set_goals (goals () @ smt_goals); set_smt_goals []; let n = List.Tot.length (goals ()) in ignore (repeat join); (* Heuristic rlimit setting :). Increase by 2 for every joined goal. Default rlimit is 5, so this is "saving" 3 rlimit units per joined goal. *) if not (Nil? (goals ())) then ( let open FStar.Mul in let rlimit = get_rlimit() + (n-1)*2 in set_rlimit rlimit ); if RU.debug_at_level (top_env ()) "pulse.join" then dump "PULSE: Goals after join"; ()
{ "file_name": "lib/steel/pulse/Pulse.Main.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 4, "end_line": 168, "start_col": 0, "start_line": 142 }
(* 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.Main module T = FStar.Tactics.V2 module R = FStar.Reflection.V2 module RT = FStar.Reflection.Typing open FStar.Tactics.V2 open Pulse.Syntax open Pulse.Typing open Pulse.Checker open Pulse.Elaborate open Pulse.Soundness module Cfg = Pulse.Config module RU = Pulse.RuntimeUtils module P = Pulse.Syntax.Printer module Rec = Pulse.Recursion let debug_main g (s: unit -> T.Tac string) : T.Tac unit = if RU.debug_at_level (fstar_env g) "pulse.main" then T.print (s ()) else () let rec mk_abs (g:env) (qbs:list (option qualifier & binder & bv)) (body:st_term) (comp:comp) : TacH st_term (fun _ -> not (Nil? qbs)) (fun _ r -> match r with FStar.Tactics.Result.Success v _ -> Tm_Abs? v.term | _ -> False) = let with_range (s:st_term') (r:range) : st_term = { term = s; range = r; effect_tag = default_effect_hint } in match qbs with | [(q, last, last_bv)] -> let body = close_st_term body last_bv.bv_index in let comp = close_comp comp last_bv.bv_index in let asc = { annotated = Some comp; elaborated = None } in with_range (Pulse.Syntax.Builder.tm_abs last q asc body) body.range | (q, b, bv)::qbs -> let body = mk_abs g qbs body comp in let body = close_st_term body bv.bv_index in with_range (Pulse.Syntax.Builder.tm_abs b q empty_ascription body) body.range let check_fndecl (d : decl{FnDecl? d.d}) (g : Soundness.Common.stt_env{bindings g == []}) (pre : term) (pre_typing : tot_typing g pre tm_vprop) : T.Tac (RT.dsl_tac_result_t (fstar_env g)) = (* Maybe add a recursive knot before starting *) let FnDecl fn_d = d.d in let nm_orig = fst (inspect_ident fn_d.id) in // keep the original name let d = if fn_d.isrec then Recursion.add_knot g d.range d else d in let FnDecl { id; isrec; bs; comp; meas; body } = d.d in let nm_aux = fst (inspect_ident id) in if Nil? bs then fail g (Some d.range) "main: FnDecl does not have binders"; let body = mk_abs g bs body comp in let rng = body.range in debug_main g (fun _ -> Printf.sprintf "\nbody after mk_abs:\n%s\n" (P.st_term_to_string body)); let (| body, c, t_typing |) = Pulse.Checker.Abs.check_abs g body Pulse.Checker.check in Pulse.Checker.Prover.debug_prover g (fun _ -> Printf.sprintf "\ncheck call returned in main with:\n%s\nat type %s\n" (P.st_term_to_string body) (P.comp_to_string c)); debug_main g (fun _ -> Printf.sprintf "\nchecker call returned in main with:\n%s\nderivation=%s\n" (P.st_term_to_string body) (Pulse.Typing.Printer.print_st_typing t_typing)); let refl_t = elab_comp c in let refl_e = Pulse.RuntimeUtils.embed_st_term_for_extraction #st_term body (Some rng) in let blob = "pulse", refl_e in soundness_lemma g body c t_typing; let main_decl = let nm = fst (inspect_ident id) in if T.ext_getv "pulse:elab_derivation" <> "" then RT.mk_checked_let (fstar_env g) nm (elab_st_typing t_typing) refl_t else Pulse.Reflection.Util.mk_opaque_let (fstar_env g) nm (elab_st_typing t_typing) refl_t in (* Set the blob *) let main_decl = let (chk, se, _) = main_decl in let se = if fn_d.isrec then ( let nm = R.pack_ln (R.Tv_Const (R.C_String nm_orig)) in let attribute = `("pulse.recursive", `#(nm)) in let se = RU.add_attribute se (`(noextract_to "krml")) in let se = RU.add_noextract_qual se in let se : T.sigelt = RU.add_attribute se attribute in se ) else se in (chk, se, Some blob) in let recursive_decls = if fn_d.isrec then Rec.tie_knot g rng nm_orig nm_aux d refl_t blob else [] in main_decl :: recursive_decls let main' (nm:string) (d:decl) (pre:term) (g:RT.fstar_top_env) : T.Tac (RT.dsl_tac_result_t g) = match Pulse.Soundness.Common.check_top_level_environment g with | None -> T.fail "pulse main: top-level environment does not include stt at the expected types" | Some g -> if RU.debug_at_level (fstar_env g) "Pulse" then T.print (Printf.sprintf "About to check pulse decl:\n%s\n" (P.decl_to_string d)); let (| pre, ty, pre_typing |) = Pulse.Checker.Pure.compute_tot_term_type g pre in if not (eq_tm ty tm_vprop) then fail g (Some pre.range) "pulse main: cannot typecheck pre at type vprop"; //fix range let pre_typing : tot_typing g pre tm_vprop = pre_typing in match d.d with | FnDecl _ -> check_fndecl d g pre pre_typing
{ "checked_file": "/", "dependencies": [ "PulseSyntaxExtension.ASTBuilder.fsti.checked", "Pulse.Typing.Printer.fst.checked", "Pulse.Typing.fst.checked", "Pulse.Syntax.Printer.fsti.checked", "Pulse.Syntax.Builder.fst.checked", "Pulse.Syntax.fst.checked", "Pulse.Soundness.Common.fst.checked", "Pulse.Soundness.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Recursion.fsti.checked", "Pulse.Elaborate.fsti.checked", "Pulse.Config.fsti.checked", "Pulse.Checker.Pure.fsti.checked", "Pulse.Checker.Prover.fsti.checked", "Pulse.Checker.Abs.fsti.checked", "Pulse.Checker.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Printf.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.Issue.fsti.checked" ], "interface_file": true, "source_file": "Pulse.Main.fst" }
[ { "abbrev": true, "full_module": "Pulse.Recursion", "short_module": "Rec" }, { "abbrev": true, "full_module": "Pulse.Syntax.Printer", "short_module": "P" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Config", "short_module": "Cfg" }, { "abbrev": false, "full_module": "Pulse.Soundness", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "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.Tactics.V2", "short_module": null }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse", "short_module": null }, { "abbrev": false, "full_module": "Pulse", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.unit", "FStar.Stubs.Tactics.V2.Builtins.dump", "Prims.bool", "Pulse.RuntimeUtils.debug_at_level", "FStar.Stubs.Reflection.Types.env", "FStar.Stubs.Tactics.V2.Builtins.top_env", "FStar.Tactics.SMT.set_rlimit", "Prims.int", "Prims.op_Addition", "FStar.Mul.op_Star", "Prims.op_Subtraction", "FStar.Tactics.SMT.get_rlimit", "Prims.op_Negation", "Prims.uu___is_Nil", "FStar.Stubs.Tactics.Types.goal", "Prims.list", "FStar.Tactics.V2.Derived.goals", "FStar.Pervasives.ignore", "FStar.Tactics.V2.Derived.repeat", "FStar.Stubs.Tactics.V2.Builtins.join", "Prims.nat", "FStar.List.Tot.Base.length", "FStar.Stubs.Tactics.V2.Builtins.set_smt_goals", "Prims.Nil", "FStar.Stubs.Tactics.V2.Builtins.set_goals", "FStar.List.Tot.Base.op_At", "FStar.Tactics.V2.Derived.smt_goals" ]
[]
false
true
false
false
false
let join_smt_goals () : Tac unit =
let open FStar.Tactics.V2 in let open FStar.List.Tot in if RU.debug_at_level (top_env ()) "pulse.join" then dump "PULSE: Goals before join"; let smt_goals = smt_goals () in set_goals (goals () @ smt_goals); set_smt_goals []; let n = List.Tot.length (goals ()) in ignore (repeat join); if not (Nil? (goals ())) then (let open FStar.Mul in let rlimit = get_rlimit () + (n - 1) * 2 in set_rlimit rlimit); if RU.debug_at_level (top_env ()) "pulse.join" then dump "PULSE: Goals after join"; ()
false
Spec.Hash.Incremental.fsti
Spec.Hash.Incremental.hash_is_hash_incremental
val hash_is_hash_incremental : a: Spec.Hash.Definitions.fixed_len_alg -> input: Lib.ByteSequence.bytes {Spec.Hash.Definitions.less_than_max_input_length (FStar.Seq.Base.length input) a} -> Prims.unit
let hash_is_hash_incremental (a: fixed_len_alg) (input: bytes { S.length input `less_than_max_input_length` a }) = hash_is_hash_incremental' a input ()
{ "file_name": "specs/lemmas/Spec.Hash.Incremental.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 38, "end_line": 31, "start_col": 0, "start_line": 30 }
module Spec.Hash.Incremental module S = FStar.Seq module Blake2 = Spec.Blake2 open Spec.Agile.Hash open Spec.Hash.Definitions open FStar.Mul open Lib.Sequence open Lib.ByteSequence open Lib.IntTypes module Loops = Lib.LoopCombinators module UpdateMulti = Lib.UpdateMulti #set-options "--fuel 0 --ifuel 0 --z3rlimit 50" /// A declaration whose sole purpose is to force synchronize the .fst and the .fsti [@must_erase_for_extraction] private val _sync_decl : Type0 include Spec.Hash.Incremental.Definitions val hash_is_hash_incremental' (a: hash_alg) (input: bytes { S.length input `less_than_max_input_length` a }) (l: output_length a): Lemma (S.equal (hash' a input l) (hash_incremental a input l))
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Incremental.Definitions.fst.checked", "Spec.Hash.Definitions.fst.checked", "Spec.Blake2.fst.checked", "Spec.Agile.Hash.fsti.checked", "prims.fst.checked", "Lib.UpdateMulti.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Hash.Incremental.fsti" }
[ { "abbrev": false, "full_module": "Spec.Hash.Incremental.Definitions", "short_module": null }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": true, "full_module": "Spec.Blake2", "short_module": "Blake2" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.UpdateMulti", "short_module": "UpdateMulti" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loops" }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile.Hash", "short_module": null }, { "abbrev": true, "full_module": "Spec.Blake2", "short_module": "Blake2" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "abbrev": false, "full_module": "Spec.Hash", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Spec.Hash.Definitions.fixed_len_alg -> input: Lib.ByteSequence.bytes {Spec.Hash.Definitions.less_than_max_input_length (FStar.Seq.Base.length input) a} -> Prims.unit
Prims.Tot
[ "total" ]
[]
[ "Spec.Hash.Definitions.fixed_len_alg", "Lib.ByteSequence.bytes", "Prims.b2t", "Spec.Hash.Definitions.less_than_max_input_length", "FStar.Seq.Base.length", "Lib.IntTypes.uint_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Hash.Incremental.hash_is_hash_incremental'", "Prims.unit" ]
[]
false
false
false
false
false
let hash_is_hash_incremental (a: fixed_len_alg) (input: bytes{(S.length input) `less_than_max_input_length` a}) =
hash_is_hash_incremental' a input ()
false
Lib.Loops.fst
Lib.Loops.while
val while: inv: (mem -> Type0) -> guard: (h:mem{inv h} -> GTot bool) -> test: (unit -> Stack bool (requires inv) (ensures fun h0 b h1 -> b == guard h0 /\ h0 == h1)) -> body: (unit -> Stack unit (requires fun h -> inv h /\ guard h) (ensures fun _ _ h -> inv h)) -> Stack unit (requires inv) (ensures fun _ _ h -> inv h /\ ~(guard h))
val while: inv: (mem -> Type0) -> guard: (h:mem{inv h} -> GTot bool) -> test: (unit -> Stack bool (requires inv) (ensures fun h0 b h1 -> b == guard h0 /\ h0 == h1)) -> body: (unit -> Stack unit (requires fun h -> inv h /\ guard h) (ensures fun _ _ h -> inv h)) -> Stack unit (requires inv) (ensures fun _ _ h -> inv h /\ ~(guard h))
let while inv guard test body = let test: unit -> Stack bool (requires fun h -> inv h) //AR: C.Loops.while precondition is written in eta-expanded form (ensures fun _ b h -> inv h /\ b == guard h) = test in C.Loops.while #inv #(fun b h -> inv h /\ b == guard h) test body
{ "file_name": "lib/Lib.Loops.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 66, "end_line": 18, "start_col": 0, "start_line": 12 }
module Lib.Loops open Lib.IntTypes let for start finish inv f = C.Loops.for start finish (fun h i -> v start <= i /\ i <= v finish /\ inv h i) (fun i -> f i)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "C.Loops.fst.checked" ], "interface_file": true, "source_file": "Lib.Loops.fst" }
[ { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "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
inv: (_: FStar.Monotonic.HyperStack.mem -> Type0) -> guard: (h: FStar.Monotonic.HyperStack.mem{inv h} -> Prims.GTot Prims.bool) -> test: (_: Prims.unit -> FStar.HyperStack.ST.Stack Prims.bool) -> body: (_: Prims.unit -> FStar.HyperStack.ST.Stack Prims.unit) -> FStar.HyperStack.ST.Stack Prims.unit
FStar.HyperStack.ST.Stack
[]
[]
[ "FStar.Monotonic.HyperStack.mem", "Prims.bool", "Prims.unit", "Prims.l_and", "Prims.eq2", "Prims.b2t", "C.Loops.while" ]
[]
false
true
false
false
false
let while inv guard test body =
let test: unit -> Stack bool (requires fun h -> inv h) (ensures fun _ b h -> inv h /\ b == guard h) = test in C.Loops.while #inv #(fun b h -> inv h /\ b == guard h) test body
false
Lib.Loops.fst
Lib.Loops.for
val for: start:size_t -> finish:size_t{v finish >= v start} -> inv:(mem -> (i:nat{v start <= i /\ i <= v finish}) -> Type0) -> f:(i:size_t{v start <= v i /\ v i < v finish} -> Stack unit (requires fun h -> inv h (v i)) (ensures fun h_1 _ h_2 -> inv h_2 (v i + 1))) -> Stack unit (requires fun h -> inv h (v start)) (ensures fun _ _ h_2 -> inv h_2 (v finish))
val for: start:size_t -> finish:size_t{v finish >= v start} -> inv:(mem -> (i:nat{v start <= i /\ i <= v finish}) -> Type0) -> f:(i:size_t{v start <= v i /\ v i < v finish} -> Stack unit (requires fun h -> inv h (v i)) (ensures fun h_1 _ h_2 -> inv h_2 (v i + 1))) -> Stack unit (requires fun h -> inv h (v start)) (ensures fun _ _ h_2 -> inv h_2 (v finish))
let for start finish inv f = C.Loops.for start finish (fun h i -> v start <= i /\ i <= v finish /\ inv h i) (fun i -> f i)
{ "file_name": "lib/Lib.Loops.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 18, "end_line": 10, "start_col": 0, "start_line": 5 }
module Lib.Loops open Lib.IntTypes
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "C.Loops.fst.checked" ], "interface_file": true, "source_file": "Lib.Loops.fst" }
[ { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "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
start: Lib.IntTypes.size_t -> finish: Lib.IntTypes.size_t{Lib.IntTypes.v finish >= Lib.IntTypes.v start} -> inv: ( _: FStar.Monotonic.HyperStack.mem -> i: Prims.nat{Lib.IntTypes.v start <= i /\ i <= Lib.IntTypes.v finish} -> Type0) -> f: ( i: Lib.IntTypes.size_t { Lib.IntTypes.v start <= Lib.IntTypes.v i /\ Lib.IntTypes.v i < Lib.IntTypes.v finish } -> FStar.HyperStack.ST.Stack Prims.unit) -> FStar.HyperStack.ST.Stack Prims.unit
FStar.HyperStack.ST.Stack
[]
[]
[ "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_GreaterThanOrEqual", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "FStar.Monotonic.HyperStack.mem", "Prims.nat", "Prims.l_and", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "Prims.unit", "Prims.op_Addition", "C.Loops.for", "FStar.UInt32.t", "FStar.UInt32.v" ]
[]
false
true
false
false
false
let for start finish inv f =
C.Loops.for start finish (fun h i -> v start <= i /\ i <= v finish /\ inv h i) (fun i -> f i)
false
Hacl.Impl.Curve25519.Generic.fsti
Hacl.Impl.Curve25519.Generic.secret_to_public_st
val secret_to_public_st : s: Hacl.Impl.Curve25519.Fields.Core.field_spec -> p: Type0 -> Type0
let secret_to_public_st (s: field_spec) (p: Type0) = o:lbuffer uint8 32ul -> i:lbuffer uint8 32ul -> Stack unit (requires fun h0 -> p /\ live h0 o /\ live h0 i /\ disjoint o i) (ensures fun h0 _ h1 -> modifies (loc o) h0 h1 /\ as_seq h1 o == S.secret_to_public (as_seq h0 i))
{ "file_name": "code/curve25519/Hacl.Impl.Curve25519.Generic.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 54, "end_line": 34, "start_col": 0, "start_line": 26 }
module Hacl.Impl.Curve25519.Generic open FStar.HyperStack open FStar.HyperStack.All open Lib.IntTypes open Lib.Buffer open Hacl.Impl.Curve25519.Fields module S = Spec.Curve25519 inline_for_extraction noextract let scalarmult_st (s:field_spec) (p: Type0) = o:lbuffer uint8 32ul -> k:lbuffer uint8 32ul -> i:lbuffer uint8 32ul -> Stack unit (requires fun h0 -> p /\ live h0 o /\ live h0 k /\ live h0 i /\ disjoint o i /\ disjoint o k) (ensures fun h0 _ h1 -> modifies (loc o) h0 h1 /\ as_seq h1 o == S.scalarmult (as_seq h0 k) (as_seq h0 i))
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.Curve25519.Fields.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.Curve25519.Generic.fsti" }
[ { "abbrev": true, "full_module": "Spec.Curve25519", "short_module": "S" }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519.Fields", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": 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
s: Hacl.Impl.Curve25519.Fields.Core.field_spec -> p: Type0 -> Type0
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Curve25519.Fields.Core.field_spec", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint8", "FStar.UInt32.__uint_to_t", "Prims.unit", "FStar.Monotonic.HyperStack.mem", "Prims.l_and", "Lib.Buffer.live", "Lib.Buffer.MUT", "Lib.Buffer.disjoint", "Lib.Buffer.modifies", "Lib.Buffer.loc", "Prims.eq2", "Lib.Sequence.lseq", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Lib.Buffer.as_seq", "Spec.Curve25519.secret_to_public" ]
[]
false
false
false
true
true
let secret_to_public_st (s: field_spec) (p: Type0) =
o: lbuffer uint8 32ul -> i: lbuffer uint8 32ul -> Stack unit (requires fun h0 -> p /\ live h0 o /\ live h0 i /\ disjoint o i) (ensures fun h0 _ h1 -> modifies (loc o) h0 h1 /\ as_seq h1 o == S.secret_to_public (as_seq h0 i))
false
Hacl.Impl.Curve25519.Generic.fsti
Hacl.Impl.Curve25519.Generic.scalarmult_st
val scalarmult_st : s: Hacl.Impl.Curve25519.Fields.Core.field_spec -> p: Type0 -> Type0
let scalarmult_st (s:field_spec) (p: Type0) = o:lbuffer uint8 32ul -> k:lbuffer uint8 32ul -> i:lbuffer uint8 32ul -> Stack unit (requires fun h0 -> p /\ live h0 o /\ live h0 k /\ live h0 i /\ disjoint o i /\ disjoint o k) (ensures fun h0 _ h1 -> modifies (loc o) h0 h1 /\ as_seq h1 o == S.scalarmult (as_seq h0 k) (as_seq h0 i))
{ "file_name": "code/curve25519/Hacl.Impl.Curve25519.Generic.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 62, "end_line": 23, "start_col": 0, "start_line": 13 }
module Hacl.Impl.Curve25519.Generic open FStar.HyperStack open FStar.HyperStack.All open Lib.IntTypes open Lib.Buffer open Hacl.Impl.Curve25519.Fields module S = Spec.Curve25519
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.Curve25519.Fields.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.Curve25519.Generic.fsti" }
[ { "abbrev": true, "full_module": "Spec.Curve25519", "short_module": "S" }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519.Fields", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": 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
s: Hacl.Impl.Curve25519.Fields.Core.field_spec -> p: Type0 -> Type0
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Curve25519.Fields.Core.field_spec", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint8", "FStar.UInt32.__uint_to_t", "Prims.unit", "FStar.Monotonic.HyperStack.mem", "Prims.l_and", "Lib.Buffer.live", "Lib.Buffer.MUT", "Lib.Buffer.disjoint", "Lib.Buffer.modifies", "Lib.Buffer.loc", "Prims.eq2", "Lib.Sequence.lseq", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Lib.Buffer.as_seq", "Spec.Curve25519.scalarmult" ]
[]
false
false
false
true
true
let scalarmult_st (s: field_spec) (p: Type0) =
o: lbuffer uint8 32ul -> k: lbuffer uint8 32ul -> i: lbuffer uint8 32ul -> Stack unit (requires fun h0 -> p /\ live h0 o /\ live h0 k /\ live h0 i /\ disjoint o i /\ disjoint o k) (ensures fun h0 _ h1 -> modifies (loc o) h0 h1 /\ as_seq h1 o == S.scalarmult (as_seq h0 k) (as_seq h0 i))
false
Pulse.Main.fst
Pulse.Main.check_pulse
val check_pulse (namespaces:list string) (module_abbrevs:list (string & string)) (content:string) (file_name:string) (line col:int) (nm:string) : RT.dsl_tac_t
val check_pulse (namespaces:list string) (module_abbrevs:list (string & string)) (content:string) (file_name:string) (line col:int) (nm:string) : RT.dsl_tac_t
let check_pulse (namespaces:list string) (module_abbrevs:list (string & string)) (content:string) (file_name:string) (line col:int) (nm:string) : RT.dsl_tac_t = fun env -> match PulseSyntaxExtension.ASTBuilder.parse_pulse env namespaces module_abbrevs content file_name line col with | Inl decl -> main nm decl tm_emp env | Inr None -> T.fail "Pulse parser failed" | Inr (Some (msg, range)) -> let i = Issue.mk_issue "Error" (Printf.sprintf "%s: %s" (T.range_to_string range) msg) (Some range) None [] in T.log_issues [i]; T.fail "Pulse parser failed"
{ "file_name": "lib/steel/pulse/Pulse.Main.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 36, "end_line": 214, "start_col": 0, "start_line": 190 }
(* 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.Main module T = FStar.Tactics.V2 module R = FStar.Reflection.V2 module RT = FStar.Reflection.Typing open FStar.Tactics.V2 open Pulse.Syntax open Pulse.Typing open Pulse.Checker open Pulse.Elaborate open Pulse.Soundness module Cfg = Pulse.Config module RU = Pulse.RuntimeUtils module P = Pulse.Syntax.Printer module Rec = Pulse.Recursion let debug_main g (s: unit -> T.Tac string) : T.Tac unit = if RU.debug_at_level (fstar_env g) "pulse.main" then T.print (s ()) else () let rec mk_abs (g:env) (qbs:list (option qualifier & binder & bv)) (body:st_term) (comp:comp) : TacH st_term (fun _ -> not (Nil? qbs)) (fun _ r -> match r with FStar.Tactics.Result.Success v _ -> Tm_Abs? v.term | _ -> False) = let with_range (s:st_term') (r:range) : st_term = { term = s; range = r; effect_tag = default_effect_hint } in match qbs with | [(q, last, last_bv)] -> let body = close_st_term body last_bv.bv_index in let comp = close_comp comp last_bv.bv_index in let asc = { annotated = Some comp; elaborated = None } in with_range (Pulse.Syntax.Builder.tm_abs last q asc body) body.range | (q, b, bv)::qbs -> let body = mk_abs g qbs body comp in let body = close_st_term body bv.bv_index in with_range (Pulse.Syntax.Builder.tm_abs b q empty_ascription body) body.range let check_fndecl (d : decl{FnDecl? d.d}) (g : Soundness.Common.stt_env{bindings g == []}) (pre : term) (pre_typing : tot_typing g pre tm_vprop) : T.Tac (RT.dsl_tac_result_t (fstar_env g)) = (* Maybe add a recursive knot before starting *) let FnDecl fn_d = d.d in let nm_orig = fst (inspect_ident fn_d.id) in // keep the original name let d = if fn_d.isrec then Recursion.add_knot g d.range d else d in let FnDecl { id; isrec; bs; comp; meas; body } = d.d in let nm_aux = fst (inspect_ident id) in if Nil? bs then fail g (Some d.range) "main: FnDecl does not have binders"; let body = mk_abs g bs body comp in let rng = body.range in debug_main g (fun _ -> Printf.sprintf "\nbody after mk_abs:\n%s\n" (P.st_term_to_string body)); let (| body, c, t_typing |) = Pulse.Checker.Abs.check_abs g body Pulse.Checker.check in Pulse.Checker.Prover.debug_prover g (fun _ -> Printf.sprintf "\ncheck call returned in main with:\n%s\nat type %s\n" (P.st_term_to_string body) (P.comp_to_string c)); debug_main g (fun _ -> Printf.sprintf "\nchecker call returned in main with:\n%s\nderivation=%s\n" (P.st_term_to_string body) (Pulse.Typing.Printer.print_st_typing t_typing)); let refl_t = elab_comp c in let refl_e = Pulse.RuntimeUtils.embed_st_term_for_extraction #st_term body (Some rng) in let blob = "pulse", refl_e in soundness_lemma g body c t_typing; let main_decl = let nm = fst (inspect_ident id) in if T.ext_getv "pulse:elab_derivation" <> "" then RT.mk_checked_let (fstar_env g) nm (elab_st_typing t_typing) refl_t else Pulse.Reflection.Util.mk_opaque_let (fstar_env g) nm (elab_st_typing t_typing) refl_t in (* Set the blob *) let main_decl = let (chk, se, _) = main_decl in let se = if fn_d.isrec then ( let nm = R.pack_ln (R.Tv_Const (R.C_String nm_orig)) in let attribute = `("pulse.recursive", `#(nm)) in let se = RU.add_attribute se (`(noextract_to "krml")) in let se = RU.add_noextract_qual se in let se : T.sigelt = RU.add_attribute se attribute in se ) else se in (chk, se, Some blob) in let recursive_decls = if fn_d.isrec then Rec.tie_knot g rng nm_orig nm_aux d refl_t blob else [] in main_decl :: recursive_decls let main' (nm:string) (d:decl) (pre:term) (g:RT.fstar_top_env) : T.Tac (RT.dsl_tac_result_t g) = match Pulse.Soundness.Common.check_top_level_environment g with | None -> T.fail "pulse main: top-level environment does not include stt at the expected types" | Some g -> if RU.debug_at_level (fstar_env g) "Pulse" then T.print (Printf.sprintf "About to check pulse decl:\n%s\n" (P.decl_to_string d)); let (| pre, ty, pre_typing |) = Pulse.Checker.Pure.compute_tot_term_type g pre in if not (eq_tm ty tm_vprop) then fail g (Some pre.range) "pulse main: cannot typecheck pre at type vprop"; //fix range let pre_typing : tot_typing g pre tm_vprop = pre_typing in match d.d with | FnDecl _ -> check_fndecl d g pre pre_typing let join_smt_goals () : Tac unit = let open FStar.Tactics.V2 in let open FStar.List.Tot in if RU.debug_at_level (top_env ()) "pulse.join" then dump "PULSE: Goals before join"; (* Join *) let smt_goals = smt_goals () in set_goals (goals () @ smt_goals); set_smt_goals []; let n = List.Tot.length (goals ()) in ignore (repeat join); (* Heuristic rlimit setting :). Increase by 2 for every joined goal. Default rlimit is 5, so this is "saving" 3 rlimit units per joined goal. *) if not (Nil? (goals ())) then ( let open FStar.Mul in let rlimit = get_rlimit() + (n-1)*2 in set_rlimit rlimit ); if RU.debug_at_level (top_env ()) "pulse.join" then dump "PULSE: Goals after join"; () let main nm t pre : RT.dsl_tac_t = fun g -> (* We use the SMT policy by default, to collect goals in the proofstate and discharge them all at the end, potentially joining them (see below). But it can be overriden to SMTSync by `--ext pulse:guard_policy=SMTSync`. *) if ext_getv "pulse:guard_policy" = "SMTSync" then set_guard_policy SMTSync else set_guard_policy SMT; let res = main' nm t pre g in if ext_getv "pulse:join" = "1" (* || ext_getv "pulse:join" <> "" *) // ^ Uncomment to make it true by default. then join_smt_goals(); res
{ "checked_file": "/", "dependencies": [ "PulseSyntaxExtension.ASTBuilder.fsti.checked", "Pulse.Typing.Printer.fst.checked", "Pulse.Typing.fst.checked", "Pulse.Syntax.Printer.fsti.checked", "Pulse.Syntax.Builder.fst.checked", "Pulse.Syntax.fst.checked", "Pulse.Soundness.Common.fst.checked", "Pulse.Soundness.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Recursion.fsti.checked", "Pulse.Elaborate.fsti.checked", "Pulse.Config.fsti.checked", "Pulse.Checker.Pure.fsti.checked", "Pulse.Checker.Prover.fsti.checked", "Pulse.Checker.Abs.fsti.checked", "Pulse.Checker.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Printf.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.Issue.fsti.checked" ], "interface_file": true, "source_file": "Pulse.Main.fst" }
[ { "abbrev": true, "full_module": "Pulse.Recursion", "short_module": "Rec" }, { "abbrev": true, "full_module": "Pulse.Syntax.Printer", "short_module": "P" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Config", "short_module": "Cfg" }, { "abbrev": false, "full_module": "Pulse.Soundness", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "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.Tactics.V2", "short_module": null }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse", "short_module": null }, { "abbrev": false, "full_module": "Pulse", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": 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
namespaces: Prims.list Prims.string -> module_abbrevs: Prims.list (Prims.string * Prims.string) -> content: Prims.string -> file_name: Prims.string -> line: Prims.int -> col: Prims.int -> nm: Prims.string -> FStar.Reflection.Typing.dsl_tac_t
Prims.Tot
[ "total" ]
[]
[ "Prims.list", "Prims.string", "FStar.Pervasives.Native.tuple2", "Prims.int", "FStar.Reflection.Typing.fstar_top_env", "Pulse.Syntax.Base.decl", "Pulse.Main.main", "Pulse.Syntax.Base.tm_emp", "FStar.Reflection.Typing.dsl_tac_result_t", "FStar.Tactics.V2.Derived.fail", "FStar.Range.range", "Prims.unit", "FStar.Stubs.Tactics.V2.Builtins.log_issues", "Prims.Cons", "FStar.Issue.issue", "Prims.Nil", "FStar.Issue.mk_issue", "FStar.Pervasives.Native.Some", "FStar.Pervasives.Native.None", "FStar.Printf.sprintf", "FStar.Stubs.Tactics.V2.Builtins.range_to_string", "FStar.Pervasives.either", "FStar.Pervasives.Native.option", "PulseSyntaxExtension.ASTBuilder.parse_pulse", "FStar.Reflection.Typing.dsl_tac_t" ]
[]
false
false
false
true
false
let check_pulse (namespaces: list string) (module_abbrevs: list (string & string)) (content file_name: string) (line col: int) (nm: string) : RT.dsl_tac_t =
fun env -> match PulseSyntaxExtension.ASTBuilder.parse_pulse env namespaces module_abbrevs content file_name line col with | Inl decl -> main nm decl tm_emp env | Inr None -> T.fail "Pulse parser failed" | Inr (Some (msg, range)) -> let i = Issue.mk_issue "Error" (Printf.sprintf "%s: %s" (T.range_to_string range) msg) (Some range) None [] in T.log_issues [i]; T.fail "Pulse parser failed"
false
Pulse.Main.fst
Pulse.Main.mk_abs
val mk_abs (g: env) (qbs: list (option qualifier & binder & bv)) (body: st_term) (comp: comp) : TacH st_term (fun _ -> not (Nil? qbs)) (fun _ r -> match r with | FStar.Tactics.Result.Success v _ -> Tm_Abs? v.term | _ -> False)
val mk_abs (g: env) (qbs: list (option qualifier & binder & bv)) (body: st_term) (comp: comp) : TacH st_term (fun _ -> not (Nil? qbs)) (fun _ r -> match r with | FStar.Tactics.Result.Success v _ -> Tm_Abs? v.term | _ -> False)
let rec mk_abs (g:env) (qbs:list (option qualifier & binder & bv)) (body:st_term) (comp:comp) : TacH st_term (fun _ -> not (Nil? qbs)) (fun _ r -> match r with FStar.Tactics.Result.Success v _ -> Tm_Abs? v.term | _ -> False) = let with_range (s:st_term') (r:range) : st_term = { term = s; range = r; effect_tag = default_effect_hint } in match qbs with | [(q, last, last_bv)] -> let body = close_st_term body last_bv.bv_index in let comp = close_comp comp last_bv.bv_index in let asc = { annotated = Some comp; elaborated = None } in with_range (Pulse.Syntax.Builder.tm_abs last q asc body) body.range | (q, b, bv)::qbs -> let body = mk_abs g qbs body comp in let body = close_st_term body bv.bv_index in with_range (Pulse.Syntax.Builder.tm_abs b q empty_ascription body) body.range
{ "file_name": "lib/steel/pulse/Pulse.Main.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 81, "end_line": 55, "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 Pulse.Main module T = FStar.Tactics.V2 module R = FStar.Reflection.V2 module RT = FStar.Reflection.Typing open FStar.Tactics.V2 open Pulse.Syntax open Pulse.Typing open Pulse.Checker open Pulse.Elaborate open Pulse.Soundness module Cfg = Pulse.Config module RU = Pulse.RuntimeUtils module P = Pulse.Syntax.Printer module Rec = Pulse.Recursion let debug_main g (s: unit -> T.Tac string) : T.Tac unit = if RU.debug_at_level (fstar_env g) "pulse.main" then T.print (s ()) else ()
{ "checked_file": "/", "dependencies": [ "PulseSyntaxExtension.ASTBuilder.fsti.checked", "Pulse.Typing.Printer.fst.checked", "Pulse.Typing.fst.checked", "Pulse.Syntax.Printer.fsti.checked", "Pulse.Syntax.Builder.fst.checked", "Pulse.Syntax.fst.checked", "Pulse.Soundness.Common.fst.checked", "Pulse.Soundness.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Recursion.fsti.checked", "Pulse.Elaborate.fsti.checked", "Pulse.Config.fsti.checked", "Pulse.Checker.Pure.fsti.checked", "Pulse.Checker.Prover.fsti.checked", "Pulse.Checker.Abs.fsti.checked", "Pulse.Checker.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Printf.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.Issue.fsti.checked" ], "interface_file": true, "source_file": "Pulse.Main.fst" }
[ { "abbrev": true, "full_module": "Pulse.Recursion", "short_module": "Rec" }, { "abbrev": true, "full_module": "Pulse.Syntax.Printer", "short_module": "P" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Config", "short_module": "Cfg" }, { "abbrev": false, "full_module": "Pulse.Soundness", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "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.Tactics.V2", "short_module": null }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse", "short_module": null }, { "abbrev": false, "full_module": "Pulse", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": 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 -> qbs: Prims.list ((FStar.Pervasives.Native.option Pulse.Syntax.Base.qualifier * Pulse.Syntax.Base.binder) * Pulse.Syntax.Base.bv) -> body: Pulse.Syntax.Base.st_term -> comp: Pulse.Syntax.Base.comp -> FStar.Tactics.Effect.TacH Pulse.Syntax.Base.st_term
FStar.Tactics.Effect.TacH
[]
[]
[ "Pulse.Typing.Env.env", "Prims.list", "FStar.Pervasives.Native.tuple3", "FStar.Pervasives.Native.option", "Pulse.Syntax.Base.qualifier", "Pulse.Syntax.Base.binder", "Pulse.Syntax.Base.bv", "Pulse.Syntax.Base.st_term", "Pulse.Syntax.Base.comp", "Pulse.Syntax.Builder.tm_abs", "Pulse.Syntax.Base.__proj__Mkst_term__item__range", "Pulse.Syntax.Base.comp_ascription", "Pulse.Syntax.Base.Mkcomp_ascription", "FStar.Pervasives.Native.Some", "FStar.Pervasives.Native.None", "Pulse.Syntax.Naming.close_comp", "Pulse.Syntax.Base.__proj__Mkbv__item__bv_index", "Pulse.Syntax.Naming.close_st_term", "Pulse.Syntax.Base.empty_ascription", "Pulse.Main.mk_abs", "Pulse.Syntax.Base.st_term'", "Pulse.Syntax.Base.range", "Pulse.Syntax.Base.Mkst_term", "Pulse.Syntax.Base.default_effect_hint", "FStar.Stubs.Tactics.Types.proofstate", "Prims.b2t", "Prims.op_Negation", "Prims.uu___is_Nil", "FStar.Stubs.Tactics.Result.__result", "Pulse.Syntax.Base.uu___is_Tm_Abs", "Pulse.Syntax.Base.__proj__Mkst_term__item__term", "Prims.l_False" ]
[ "recursion" ]
false
true
false
false
false
let rec mk_abs (g: env) (qbs: list (option qualifier & binder & bv)) (body: st_term) (comp: comp) : TacH st_term (fun _ -> not (Nil? qbs)) (fun _ r -> match r with | FStar.Tactics.Result.Success v _ -> Tm_Abs? v.term | _ -> False) =
let with_range (s: st_term') (r: range) : st_term = { term = s; range = r; effect_tag = default_effect_hint } in match qbs with | [q, last, last_bv] -> let body = close_st_term body last_bv.bv_index in let comp = close_comp comp last_bv.bv_index in let asc = { annotated = Some comp; elaborated = None } in with_range (Pulse.Syntax.Builder.tm_abs last q asc body) body.range | (q, b, bv) :: qbs -> let body = mk_abs g qbs body comp in let body = close_st_term body bv.bv_index in with_range (Pulse.Syntax.Builder.tm_abs b q empty_ascription body) body.range
false
Pulse.Main.fst
Pulse.Main.main'
val main' (nm: string) (d: decl) (pre: term) (g: RT.fstar_top_env) : T.Tac (RT.dsl_tac_result_t g)
val main' (nm: string) (d: decl) (pre: term) (g: RT.fstar_top_env) : T.Tac (RT.dsl_tac_result_t g)
let main' (nm:string) (d:decl) (pre:term) (g:RT.fstar_top_env) : T.Tac (RT.dsl_tac_result_t g) = match Pulse.Soundness.Common.check_top_level_environment g with | None -> T.fail "pulse main: top-level environment does not include stt at the expected types" | Some g -> if RU.debug_at_level (fstar_env g) "Pulse" then T.print (Printf.sprintf "About to check pulse decl:\n%s\n" (P.decl_to_string d)); let (| pre, ty, pre_typing |) = Pulse.Checker.Pure.compute_tot_term_type g pre in if not (eq_tm ty tm_vprop) then fail g (Some pre.range) "pulse main: cannot typecheck pre at type vprop"; //fix range let pre_typing : tot_typing g pre tm_vprop = pre_typing in match d.d with | FnDecl _ -> check_fndecl d g pre pre_typing
{ "file_name": "lib/steel/pulse/Pulse.Main.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 39, "end_line": 140, "start_col": 0, "start_line": 127 }
(* 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.Main module T = FStar.Tactics.V2 module R = FStar.Reflection.V2 module RT = FStar.Reflection.Typing open FStar.Tactics.V2 open Pulse.Syntax open Pulse.Typing open Pulse.Checker open Pulse.Elaborate open Pulse.Soundness module Cfg = Pulse.Config module RU = Pulse.RuntimeUtils module P = Pulse.Syntax.Printer module Rec = Pulse.Recursion let debug_main g (s: unit -> T.Tac string) : T.Tac unit = if RU.debug_at_level (fstar_env g) "pulse.main" then T.print (s ()) else () let rec mk_abs (g:env) (qbs:list (option qualifier & binder & bv)) (body:st_term) (comp:comp) : TacH st_term (fun _ -> not (Nil? qbs)) (fun _ r -> match r with FStar.Tactics.Result.Success v _ -> Tm_Abs? v.term | _ -> False) = let with_range (s:st_term') (r:range) : st_term = { term = s; range = r; effect_tag = default_effect_hint } in match qbs with | [(q, last, last_bv)] -> let body = close_st_term body last_bv.bv_index in let comp = close_comp comp last_bv.bv_index in let asc = { annotated = Some comp; elaborated = None } in with_range (Pulse.Syntax.Builder.tm_abs last q asc body) body.range | (q, b, bv)::qbs -> let body = mk_abs g qbs body comp in let body = close_st_term body bv.bv_index in with_range (Pulse.Syntax.Builder.tm_abs b q empty_ascription body) body.range let check_fndecl (d : decl{FnDecl? d.d}) (g : Soundness.Common.stt_env{bindings g == []}) (pre : term) (pre_typing : tot_typing g pre tm_vprop) : T.Tac (RT.dsl_tac_result_t (fstar_env g)) = (* Maybe add a recursive knot before starting *) let FnDecl fn_d = d.d in let nm_orig = fst (inspect_ident fn_d.id) in // keep the original name let d = if fn_d.isrec then Recursion.add_knot g d.range d else d in let FnDecl { id; isrec; bs; comp; meas; body } = d.d in let nm_aux = fst (inspect_ident id) in if Nil? bs then fail g (Some d.range) "main: FnDecl does not have binders"; let body = mk_abs g bs body comp in let rng = body.range in debug_main g (fun _ -> Printf.sprintf "\nbody after mk_abs:\n%s\n" (P.st_term_to_string body)); let (| body, c, t_typing |) = Pulse.Checker.Abs.check_abs g body Pulse.Checker.check in Pulse.Checker.Prover.debug_prover g (fun _ -> Printf.sprintf "\ncheck call returned in main with:\n%s\nat type %s\n" (P.st_term_to_string body) (P.comp_to_string c)); debug_main g (fun _ -> Printf.sprintf "\nchecker call returned in main with:\n%s\nderivation=%s\n" (P.st_term_to_string body) (Pulse.Typing.Printer.print_st_typing t_typing)); let refl_t = elab_comp c in let refl_e = Pulse.RuntimeUtils.embed_st_term_for_extraction #st_term body (Some rng) in let blob = "pulse", refl_e in soundness_lemma g body c t_typing; let main_decl = let nm = fst (inspect_ident id) in if T.ext_getv "pulse:elab_derivation" <> "" then RT.mk_checked_let (fstar_env g) nm (elab_st_typing t_typing) refl_t else Pulse.Reflection.Util.mk_opaque_let (fstar_env g) nm (elab_st_typing t_typing) refl_t in (* Set the blob *) let main_decl = let (chk, se, _) = main_decl in let se = if fn_d.isrec then ( let nm = R.pack_ln (R.Tv_Const (R.C_String nm_orig)) in let attribute = `("pulse.recursive", `#(nm)) in let se = RU.add_attribute se (`(noextract_to "krml")) in let se = RU.add_noextract_qual se in let se : T.sigelt = RU.add_attribute se attribute in se ) else se in (chk, se, Some blob) in let recursive_decls = if fn_d.isrec then Rec.tie_knot g rng nm_orig nm_aux d refl_t blob else [] in main_decl :: recursive_decls
{ "checked_file": "/", "dependencies": [ "PulseSyntaxExtension.ASTBuilder.fsti.checked", "Pulse.Typing.Printer.fst.checked", "Pulse.Typing.fst.checked", "Pulse.Syntax.Printer.fsti.checked", "Pulse.Syntax.Builder.fst.checked", "Pulse.Syntax.fst.checked", "Pulse.Soundness.Common.fst.checked", "Pulse.Soundness.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Recursion.fsti.checked", "Pulse.Elaborate.fsti.checked", "Pulse.Config.fsti.checked", "Pulse.Checker.Pure.fsti.checked", "Pulse.Checker.Prover.fsti.checked", "Pulse.Checker.Abs.fsti.checked", "Pulse.Checker.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Printf.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.Issue.fsti.checked" ], "interface_file": true, "source_file": "Pulse.Main.fst" }
[ { "abbrev": true, "full_module": "Pulse.Recursion", "short_module": "Rec" }, { "abbrev": true, "full_module": "Pulse.Syntax.Printer", "short_module": "P" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Config", "short_module": "Cfg" }, { "abbrev": false, "full_module": "Pulse.Soundness", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "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.Tactics.V2", "short_module": null }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse", "short_module": null }, { "abbrev": false, "full_module": "Pulse", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": 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: Prims.string -> d: Pulse.Syntax.Base.decl -> pre: Pulse.Syntax.Base.term -> g: FStar.Reflection.Typing.fstar_top_env -> FStar.Tactics.Effect.Tac (FStar.Reflection.Typing.dsl_tac_result_t g)
FStar.Tactics.Effect.Tac
[]
[]
[ "Prims.string", "Pulse.Syntax.Base.decl", "Pulse.Syntax.Base.term", "FStar.Reflection.Typing.fstar_top_env", "Pulse.Soundness.Common.check_top_level_environment", "FStar.Tactics.V2.Derived.fail", "FStar.Reflection.Typing.dsl_tac_result_t", "Pulse.Soundness.Common.stt_env", "Pulse.Syntax.Base.typ", "Pulse.Typing.tot_typing", "Pulse.Syntax.Base.__proj__Mkdecl__item__d", "Pulse.Syntax.Base.decl'__FnDecl__payload", "Pulse.Main.check_fndecl", "Pulse.Typing.Env.fstar_env", "Pulse.Syntax.Base.tm_vprop", "Prims.unit", "Prims.op_Negation", "Pulse.Syntax.Base.eq_tm", "Pulse.Typing.Env.fail", "FStar.Pervasives.Native.Some", "Pulse.Syntax.Base.range", "Pulse.Syntax.Base.__proj__Mkterm__item__range", "Prims.bool", "FStar.Pervasives.dtuple3", "Pulse.Checker.Pure.compute_tot_term_type", "Pulse.RuntimeUtils.debug_at_level", "FStar.Stubs.Tactics.V2.Builtins.print", "FStar.Printf.sprintf", "Pulse.Syntax.Printer.decl_to_string" ]
[]
false
true
false
false
false
let main' (nm: string) (d: decl) (pre: term) (g: RT.fstar_top_env) : T.Tac (RT.dsl_tac_result_t g) =
match Pulse.Soundness.Common.check_top_level_environment g with | None -> T.fail "pulse main: top-level environment does not include stt at the expected types" | Some g -> if RU.debug_at_level (fstar_env g) "Pulse" then T.print (Printf.sprintf "About to check pulse decl:\n%s\n" (P.decl_to_string d)); let (| pre , ty , pre_typing |) = Pulse.Checker.Pure.compute_tot_term_type g pre in if not (eq_tm ty tm_vprop) then fail g (Some pre.range) "pulse main: cannot typecheck pre at type vprop"; let pre_typing:tot_typing g pre tm_vprop = pre_typing in match d.d with | FnDecl _ -> check_fndecl d g pre pre_typing
false
Lib.Loops.fst
Lib.Loops.square_while
val square_while: unit -> Stack UInt32.t (fun _ -> true) (fun h0 x h1 -> x == 9ul)
val square_while: unit -> Stack UInt32.t (fun _ -> true) (fun h0 x h1 -> x == 9ul)
let square_while () = let open LowStar.Buffer in let open LowStar.BufferOps in let open FStar.UInt32 in push_frame(); let l = [ 1ul; 2ul; 3ul ] in let b = alloca_of_list l in let r = alloca 0ul 1ul in let h = HyperStack.ST.get() in assert (forall i. Seq.index (Seq.seq_of_list l) i == List.Tot.index l i); let h0 = HyperStack.ST.get () in let inv h = live h b /\ live h r /\ get h r 0 <=^ 3ul /\ (forall (i:nat{i < 3}). i < v (get h r 0) ==> get h b i == get h0 b i *^ get h0 b i) /\ (forall (i:nat{i < 3}). v (get h r 0) <= i ==> get h b i == get h0 b i) in let guard h = get h r 0 <^ 3ul in while inv guard (fun () -> !*r <^ 3ul) (fun () -> b.(!*r) <- b.(!*r) *^ b.(!*r); r.(0ul) <- !*r +^ 1ul ); let x = b.(2ul) in pop_frame(); x
{ "file_name": "lib/Lib.Loops.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 3, "end_line": 48, "start_col": 0, "start_line": 25 }
module Lib.Loops open Lib.IntTypes let for start finish inv f = C.Loops.for start finish (fun h i -> v start <= i /\ i <= v finish /\ inv h i) (fun i -> f i) let while inv guard test body = let test: unit -> Stack bool (requires fun h -> inv h) //AR: C.Loops.while precondition is written in eta-expanded form (ensures fun _ b h -> inv h /\ b == guard h) = test in C.Loops.while #inv #(fun b h -> inv h /\ b == guard h) test body /// Test #set-options "--max_fuel 3 --max_ifuel 0 --z3rlimit 50"
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.IntTypes.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "C.Loops.fst.checked" ], "interface_file": true, "source_file": "Lib.Loops.fst" }
[ { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "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": 3, "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
_: Prims.unit -> FStar.HyperStack.ST.Stack FStar.UInt32.t
FStar.HyperStack.ST.Stack
[]
[]
[ "Prims.unit", "FStar.UInt32.t", "FStar.HyperStack.ST.pop_frame", "LowStar.BufferOps.op_Array_Access", "LowStar.Buffer.trivial_preorder", "FStar.UInt32.__uint_to_t", "Lib.Loops.while", "FStar.UInt32.op_Less_Hat", "Prims.bool", "LowStar.BufferOps.op_Bang_Star", "LowStar.BufferOps.op_Array_Assignment", "FStar.UInt32.op_Plus_Hat", "FStar.UInt32.op_Star_Hat", "FStar.Monotonic.HyperStack.mem", "LowStar.Monotonic.Buffer.get", "Prims.logical", "Prims.l_and", "LowStar.Monotonic.Buffer.live", "Prims.b2t", "FStar.UInt32.op_Less_Equals_Hat", "Prims.l_Forall", "Prims.nat", "Prims.op_LessThan", "Prims.l_imp", "FStar.UInt32.v", "Prims.eq2", "Prims.op_LessThanOrEqual", "FStar.HyperStack.ST.get", "Prims._assert", "FStar.Seq.Base.length", "FStar.Seq.Base.seq_of_list", "FStar.List.Tot.Base.length", "FStar.Seq.Base.index", "FStar.List.Tot.Base.index", "LowStar.Monotonic.Buffer.mbuffer", "LowStar.Monotonic.Buffer.length", "FStar.UInt32.uint_to_t", "Prims.op_Negation", "LowStar.Monotonic.Buffer.g_is_null", "LowStar.Buffer.alloca", "FStar.Pervasives.normalize_term", "LowStar.Buffer.alloca_of_list", "Prims.list", "Prims.Cons", "Prims.Nil", "FStar.HyperStack.ST.push_frame" ]
[]
false
true
false
false
false
let square_while () =
let open LowStar.Buffer in let open LowStar.BufferOps in let open FStar.UInt32 in push_frame (); let l = [1ul; 2ul; 3ul] in let b = alloca_of_list l in let r = alloca 0ul 1ul in let h = HyperStack.ST.get () in assert (forall i. Seq.index (Seq.seq_of_list l) i == List.Tot.index l i); let h0 = HyperStack.ST.get () in let inv h = live h b /\ live h r /\ get h r 0 <=^ 3ul /\ (forall (i: nat{i < 3}). i < v (get h r 0) ==> get h b i == get h0 b i *^ get h0 b i) /\ (forall (i: nat{i < 3}). v (get h r 0) <= i ==> get h b i == get h0 b i) in let guard h = get h r 0 <^ 3ul in while inv guard (fun () -> !*r <^ 3ul) (fun () -> b.(!*r) <- b.(!*r) *^ b.(!*r); r.(0ul) <- !*r +^ 1ul); let x = b.(2ul) in pop_frame (); x
false
Hacl.Impl.Curve25519.Generic.fsti
Hacl.Impl.Curve25519.Generic.ecdh_st
val ecdh_st : s: Hacl.Impl.Curve25519.Fields.Core.field_spec -> p: Type0 -> Type0
let ecdh_st (s:field_spec) (p: Type0) = o:lbuffer uint8 32ul -> k:lbuffer uint8 32ul -> i:lbuffer uint8 32ul -> Stack bool (requires fun h0 -> p /\ live h0 o /\ live h0 k /\ live h0 i /\ disjoint o i /\ disjoint o k) (ensures fun h0 r h1 -> modifies (loc o) h0 h1 /\ as_seq h1 o == S.scalarmult (as_seq h0 k) (as_seq h0 i) /\ (not r == Lib.ByteSequence.lbytes_eq #32 (as_seq h1 o) (Lib.Sequence.create 32 (u8 0))))
{ "file_name": "code/curve25519/Hacl.Impl.Curve25519.Generic.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 97, "end_line": 48, "start_col": 0, "start_line": 37 }
module Hacl.Impl.Curve25519.Generic open FStar.HyperStack open FStar.HyperStack.All open Lib.IntTypes open Lib.Buffer open Hacl.Impl.Curve25519.Fields module S = Spec.Curve25519 inline_for_extraction noextract let scalarmult_st (s:field_spec) (p: Type0) = o:lbuffer uint8 32ul -> k:lbuffer uint8 32ul -> i:lbuffer uint8 32ul -> Stack unit (requires fun h0 -> p /\ live h0 o /\ live h0 k /\ live h0 i /\ disjoint o i /\ disjoint o k) (ensures fun h0 _ h1 -> modifies (loc o) h0 h1 /\ as_seq h1 o == S.scalarmult (as_seq h0 k) (as_seq h0 i)) inline_for_extraction noextract let secret_to_public_st (s: field_spec) (p: Type0) = o:lbuffer uint8 32ul -> i:lbuffer uint8 32ul -> Stack unit (requires fun h0 -> p /\ live h0 o /\ live h0 i /\ disjoint o i) (ensures fun h0 _ h1 -> modifies (loc o) h0 h1 /\ as_seq h1 o == S.secret_to_public (as_seq h0 i))
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.Curve25519.Fields.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.Curve25519.Generic.fsti" }
[ { "abbrev": true, "full_module": "Spec.Curve25519", "short_module": "S" }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519.Fields", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": 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
s: Hacl.Impl.Curve25519.Fields.Core.field_spec -> p: Type0 -> Type0
Prims.Tot
[ "total" ]
[]
[ "Hacl.Impl.Curve25519.Fields.Core.field_spec", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint8", "FStar.UInt32.__uint_to_t", "Prims.bool", "FStar.Monotonic.HyperStack.mem", "Prims.l_and", "Lib.Buffer.live", "Lib.Buffer.MUT", "Lib.Buffer.disjoint", "Lib.Buffer.modifies", "Lib.Buffer.loc", "Prims.eq2", "Lib.Sequence.lseq", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Lib.Buffer.as_seq", "Spec.Curve25519.scalarmult", "Prims.op_Negation", "Lib.ByteSequence.lbytes_eq", "Lib.Sequence.create", "Lib.IntTypes.uint_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Lib.IntTypes.u8" ]
[]
false
false
false
true
true
let ecdh_st (s: field_spec) (p: Type0) =
o: lbuffer uint8 32ul -> k: lbuffer uint8 32ul -> i: lbuffer uint8 32ul -> Stack bool (requires fun h0 -> p /\ live h0 o /\ live h0 k /\ live h0 i /\ disjoint o i /\ disjoint o k) (ensures fun h0 r h1 -> modifies (loc o) h0 h1 /\ as_seq h1 o == S.scalarmult (as_seq h0 k) (as_seq h0 i) /\ (not r == Lib.ByteSequence.lbytes_eq #32 (as_seq h1 o) (Lib.Sequence.create 32 (u8 0))))
false
Pulse.Main.fst
Pulse.Main.check_fndecl
val check_fndecl (d: decl{FnDecl? d.d}) (g: Soundness.Common.stt_env{bindings g == []}) (pre: term) (pre_typing: tot_typing g pre tm_vprop) : T.Tac (RT.dsl_tac_result_t (fstar_env g))
val check_fndecl (d: decl{FnDecl? d.d}) (g: Soundness.Common.stt_env{bindings g == []}) (pre: term) (pre_typing: tot_typing g pre tm_vprop) : T.Tac (RT.dsl_tac_result_t (fstar_env g))
let check_fndecl (d : decl{FnDecl? d.d}) (g : Soundness.Common.stt_env{bindings g == []}) (pre : term) (pre_typing : tot_typing g pre tm_vprop) : T.Tac (RT.dsl_tac_result_t (fstar_env g)) = (* Maybe add a recursive knot before starting *) let FnDecl fn_d = d.d in let nm_orig = fst (inspect_ident fn_d.id) in // keep the original name let d = if fn_d.isrec then Recursion.add_knot g d.range d else d in let FnDecl { id; isrec; bs; comp; meas; body } = d.d in let nm_aux = fst (inspect_ident id) in if Nil? bs then fail g (Some d.range) "main: FnDecl does not have binders"; let body = mk_abs g bs body comp in let rng = body.range in debug_main g (fun _ -> Printf.sprintf "\nbody after mk_abs:\n%s\n" (P.st_term_to_string body)); let (| body, c, t_typing |) = Pulse.Checker.Abs.check_abs g body Pulse.Checker.check in Pulse.Checker.Prover.debug_prover g (fun _ -> Printf.sprintf "\ncheck call returned in main with:\n%s\nat type %s\n" (P.st_term_to_string body) (P.comp_to_string c)); debug_main g (fun _ -> Printf.sprintf "\nchecker call returned in main with:\n%s\nderivation=%s\n" (P.st_term_to_string body) (Pulse.Typing.Printer.print_st_typing t_typing)); let refl_t = elab_comp c in let refl_e = Pulse.RuntimeUtils.embed_st_term_for_extraction #st_term body (Some rng) in let blob = "pulse", refl_e in soundness_lemma g body c t_typing; let main_decl = let nm = fst (inspect_ident id) in if T.ext_getv "pulse:elab_derivation" <> "" then RT.mk_checked_let (fstar_env g) nm (elab_st_typing t_typing) refl_t else Pulse.Reflection.Util.mk_opaque_let (fstar_env g) nm (elab_st_typing t_typing) refl_t in (* Set the blob *) let main_decl = let (chk, se, _) = main_decl in let se = if fn_d.isrec then ( let nm = R.pack_ln (R.Tv_Const (R.C_String nm_orig)) in let attribute = `("pulse.recursive", `#(nm)) in let se = RU.add_attribute se (`(noextract_to "krml")) in let se = RU.add_noextract_qual se in let se : T.sigelt = RU.add_attribute se attribute in se ) else se in (chk, se, Some blob) in let recursive_decls = if fn_d.isrec then Rec.tie_knot g rng nm_orig nm_aux d refl_t blob else [] in main_decl :: recursive_decls
{ "file_name": "lib/steel/pulse/Pulse.Main.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 30, "end_line": 125, "start_col": 0, "start_line": 57 }
(* 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.Main module T = FStar.Tactics.V2 module R = FStar.Reflection.V2 module RT = FStar.Reflection.Typing open FStar.Tactics.V2 open Pulse.Syntax open Pulse.Typing open Pulse.Checker open Pulse.Elaborate open Pulse.Soundness module Cfg = Pulse.Config module RU = Pulse.RuntimeUtils module P = Pulse.Syntax.Printer module Rec = Pulse.Recursion let debug_main g (s: unit -> T.Tac string) : T.Tac unit = if RU.debug_at_level (fstar_env g) "pulse.main" then T.print (s ()) else () let rec mk_abs (g:env) (qbs:list (option qualifier & binder & bv)) (body:st_term) (comp:comp) : TacH st_term (fun _ -> not (Nil? qbs)) (fun _ r -> match r with FStar.Tactics.Result.Success v _ -> Tm_Abs? v.term | _ -> False) = let with_range (s:st_term') (r:range) : st_term = { term = s; range = r; effect_tag = default_effect_hint } in match qbs with | [(q, last, last_bv)] -> let body = close_st_term body last_bv.bv_index in let comp = close_comp comp last_bv.bv_index in let asc = { annotated = Some comp; elaborated = None } in with_range (Pulse.Syntax.Builder.tm_abs last q asc body) body.range | (q, b, bv)::qbs -> let body = mk_abs g qbs body comp in let body = close_st_term body bv.bv_index in with_range (Pulse.Syntax.Builder.tm_abs b q empty_ascription body) body.range
{ "checked_file": "/", "dependencies": [ "PulseSyntaxExtension.ASTBuilder.fsti.checked", "Pulse.Typing.Printer.fst.checked", "Pulse.Typing.fst.checked", "Pulse.Syntax.Printer.fsti.checked", "Pulse.Syntax.Builder.fst.checked", "Pulse.Syntax.fst.checked", "Pulse.Soundness.Common.fst.checked", "Pulse.Soundness.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Recursion.fsti.checked", "Pulse.Elaborate.fsti.checked", "Pulse.Config.fsti.checked", "Pulse.Checker.Pure.fsti.checked", "Pulse.Checker.Prover.fsti.checked", "Pulse.Checker.Abs.fsti.checked", "Pulse.Checker.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Printf.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.Issue.fsti.checked" ], "interface_file": true, "source_file": "Pulse.Main.fst" }
[ { "abbrev": true, "full_module": "Pulse.Recursion", "short_module": "Rec" }, { "abbrev": true, "full_module": "Pulse.Syntax.Printer", "short_module": "P" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Config", "short_module": "Cfg" }, { "abbrev": false, "full_module": "Pulse.Soundness", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "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.Tactics.V2", "short_module": null }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse", "short_module": null }, { "abbrev": false, "full_module": "Pulse", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": 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
d: Pulse.Syntax.Base.decl{FnDecl? (Mkdecl?.d d)} -> g: Pulse.Soundness.Common.stt_env{Pulse.Typing.Env.bindings g == []} -> pre: Pulse.Syntax.Base.term -> pre_typing: Pulse.Typing.tot_typing g pre Pulse.Syntax.Base.tm_vprop -> FStar.Tactics.Effect.Tac (FStar.Reflection.Typing.dsl_tac_result_t (Pulse.Typing.Env.fstar_env g))
FStar.Tactics.Effect.Tac
[]
[]
[ "Pulse.Syntax.Base.decl", "Prims.b2t", "Pulse.Syntax.Base.uu___is_FnDecl", "Pulse.Syntax.Base.__proj__Mkdecl__item__d", "Pulse.Soundness.Common.stt_env", "Prims.eq2", "Prims.list", "Pulse.Typing.Env.binding", "Pulse.Typing.Env.bindings", "Prims.Nil", "Pulse.Syntax.Base.term", "Pulse.Typing.tot_typing", "Pulse.Syntax.Base.tm_vprop", "Pulse.Syntax.Base.decl'__FnDecl__payload", "FStar.Stubs.Reflection.Types.ident", "Prims.bool", "FStar.Pervasives.Native.tuple3", "FStar.Pervasives.Native.option", "Pulse.Syntax.Base.qualifier", "Pulse.Syntax.Base.binder", "Pulse.Syntax.Base.bv", "Pulse.Syntax.Base.comp", "Prims.l_imp", "FStar.Pervasives.Native.uu___is_Some", "Pulse.Syntax.Base.st_term", "Pulse.Typing.st_typing", "Prims.Cons", "FStar.Reflection.Typing.sigelt_for", "Pulse.Typing.Env.fstar_env", "FStar.Reflection.Typing.dsl_tac_result_t", "Pulse.Syntax.Base.__proj__Mkdecl'__FnDecl__payload__item__isrec", "Pulse.Recursion.tie_knot", "FStar.Stubs.Reflection.Types.sigelt", "FStar.Reflection.Typing.blob", "FStar.Pervasives.Native.Mktuple3", "FStar.Pervasives.Native.Some", "Pulse.RuntimeUtils.add_attribute", "Pulse.RuntimeUtils.add_noextract_qual", "FStar.Stubs.Reflection.Types.term", "FStar.Stubs.Reflection.V2.Builtins.pack_ln", "FStar.Stubs.Reflection.V2.Data.Tv_Const", "FStar.Stubs.Reflection.V2.Data.C_String", "FStar.Reflection.Typing.mk_checked_let", "Pulse.Elaborate.Core.elab_st_typing", "Pulse.Reflection.Util.mk_opaque_let", "FStar.Ghost.hide", "Prims.op_disEquality", "Prims.string", "FStar.Stubs.Tactics.V2.Builtins.ext_getv", "FStar.Pervasives.Native.fst", "FStar.Range.range", "FStar.Stubs.Reflection.V2.Builtins.inspect_ident", "Prims.unit", "Pulse.Soundness.soundness_lemma", "FStar.Pervasives.Native.tuple2", "FStar.Pervasives.Native.Mktuple2", "Pulse.RuntimeUtils.embed_st_term_for_extraction", "Pulse.Elaborate.Pure.elab_comp", "Pulse.Main.debug_main", "FStar.Printf.sprintf", "Pulse.Syntax.Printer.st_term_to_string", "Pulse.Typing.Printer.print_st_typing", "Pulse.Checker.Prover.Util.debug_prover", "Pulse.Syntax.Printer.comp_to_string", "FStar.Pervasives.dtuple3", "Pulse.Checker.Abs.check_abs", "Pulse.Checker.check", "Pulse.Syntax.Base.range", "Pulse.Syntax.Base.__proj__Mkst_term__item__range", "Pulse.Main.mk_abs", "Prims.uu___is_Nil", "Pulse.Typing.Env.fail", "Pulse.Syntax.Base.__proj__Mkdecl__item__range", "Pulse.Syntax.Base.decl'", "Pulse.Recursion.add_knot", "Pulse.Syntax.Base.__proj__Mkdecl'__FnDecl__payload__item__id" ]
[]
false
true
false
false
false
let check_fndecl (d: decl{FnDecl? d.d}) (g: Soundness.Common.stt_env{bindings g == []}) (pre: term) (pre_typing: tot_typing g pre tm_vprop) : T.Tac (RT.dsl_tac_result_t (fstar_env g)) =
let FnDecl fn_d = d.d in let nm_orig = fst (inspect_ident fn_d.id) in let d = if fn_d.isrec then Recursion.add_knot g d.range d else d in let FnDecl { id = id ; isrec = isrec ; bs = bs ; comp = comp ; meas = meas ; body = body } = d.d in let nm_aux = fst (inspect_ident id) in if Nil? bs then fail g (Some d.range) "main: FnDecl does not have binders"; let body = mk_abs g bs body comp in let rng = body.range in debug_main g (fun _ -> Printf.sprintf "\nbody after mk_abs:\n%s\n" (P.st_term_to_string body)); let (| body , c , t_typing |) = Pulse.Checker.Abs.check_abs g body Pulse.Checker.check in Pulse.Checker.Prover.debug_prover g (fun _ -> Printf.sprintf "\ncheck call returned in main with:\n%s\nat type %s\n" (P.st_term_to_string body) (P.comp_to_string c)); debug_main g (fun _ -> Printf.sprintf "\nchecker call returned in main with:\n%s\nderivation=%s\n" (P.st_term_to_string body) (Pulse.Typing.Printer.print_st_typing t_typing)); let refl_t = elab_comp c in let refl_e = Pulse.RuntimeUtils.embed_st_term_for_extraction #st_term body (Some rng) in let blob = "pulse", refl_e in soundness_lemma g body c t_typing; let main_decl = let nm = fst (inspect_ident id) in if T.ext_getv "pulse:elab_derivation" <> "" then RT.mk_checked_let (fstar_env g) nm (elab_st_typing t_typing) refl_t else Pulse.Reflection.Util.mk_opaque_let (fstar_env g) nm (elab_st_typing t_typing) refl_t in let main_decl = let chk, se, _ = main_decl in let se = if fn_d.isrec then (let nm = R.pack_ln (R.Tv_Const (R.C_String nm_orig)) in let attribute = `("pulse.recursive", (`#(nm))) in let se = RU.add_attribute se (`(noextract_to "krml")) in let se = RU.add_noextract_qual se in let se:T.sigelt = RU.add_attribute se attribute in se) else se in (chk, se, Some blob) in let recursive_decls = if fn_d.isrec then Rec.tie_knot g rng nm_orig nm_aux d refl_t blob else [] in main_decl :: recursive_decls
false
TwoLockQueue.fst
TwoLockQueue.new_queue
val new_queue (#a: _) (x: a) : SteelT (t a) emp (fun _ -> emp)
val new_queue (#a: _) (x: a) : SteelT (t a) emp (fun _ -> emp)
let new_queue (#a:_) (x:a) : SteelT (t a) emp (fun _ -> emp) = let new_qptr (#a:_) (q:Q.t a) : SteelT (q_ptr a) emp (fun qp -> ghost_pts_to qp.ghost half q) = // Allocates the concrete pointer. let ptr = alloc_pt q in // Allocates the ghost state, and sets the corresponding lock invariant let ghost = ghost_alloc_pt q in ghost_share_pt ghost; intro_exists _ (fun q -> pts_to ptr full q `star` ghost_pts_to ghost half q); let lock = Steel.SpinLock.new_lock _ in { ptr; ghost; lock} in // Creating a concrete queue let hd = Q.new_queue x in // Creating the head and queue pointers let head = new_qptr hd in let tail = new_qptr hd in // Creating the global queue invariant pack_queue_invariant (hide hd) (hide hd) head tail; let inv = new_invariant _ in // Packing the different components to return a queue, as defined in type `t` return ({ head; tail; inv })
{ "file_name": "share/steel/examples/steel/TwoLockQueue.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 32, "end_line": 162, "start_col": 0, "start_line": 140 }
module TwoLockQueue open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect open Steel.FractionalPermission open Steel.Reference open Steel.SpinLock module L = FStar.List.Tot module U = Steel.Utils module Q = Queue /// This module provides an implementation of Michael and Scott's two lock queue, using the /// abstract interface for queues provided in Queue.fsti. /// This implementation allows an enqueue and a dequeue operation to safely operate in parallel. /// There is a lock associated to both the enqueuer and the dequeuer, which guards each of those operation, /// ensuring that at most one enqueue (resp. dequeue) is happening at any time /// We only prove that this implementation is memory safe, and do not prove the functional correctness of the concurrent queue #push-options "--ide_id_info_off" /// Adding the definition of the vprop equivalence to the context, for proof purposes let _: squash (forall p q. p `equiv` q <==> hp_of p `Steel.Memory.equiv` hp_of q) = Classical.forall_intro_2 reveal_equiv (* Some wrappers to reduce clutter in the code *) [@@__reduce__] let full = full_perm [@@__reduce__] let half = half_perm full (* Wrappers around fst and snd to avoid overnormalization. TODO: The frame inference tactic should not normalize fst and snd *) let fst x = fst x let snd x = snd x (* Some wrappers around Steel functions which are easier to use inside this module *) let ghost_gather (#a:Type) (#u:_) (#p0 #p1:perm) (#p:perm{p == sum_perm p0 p1}) (x0 #x1:erased a) (r:ghost_ref a) : SteelGhost unit u (ghost_pts_to r p0 x0 `star` ghost_pts_to r p1 x1) (fun _ -> ghost_pts_to r p x0) (requires fun _ -> True) (ensures fun _ _ _ -> x0 == x1) = let _ = ghost_gather_pt #a #u #p0 #p1 r in () let rewrite #u (p q:vprop) : SteelGhost unit u p (fun _ -> q) (requires fun _ -> p `equiv` q) (ensures fun _ _ _ -> True) = rewrite_slprop p q (fun _ -> reveal_equiv p q) let elim_pure (#p:prop) #u () : SteelGhost unit u (pure p) (fun _ -> emp) (requires fun _ -> True) (ensures fun _ _ _ -> p) = let _ = Steel.Effect.Atomic.elim_pure p in () let open_exists (#a:Type) (#opened_invariants:_) (#p:a -> vprop) (_:unit) : SteelGhostT (Ghost.erased a) opened_invariants (h_exists p) (fun r -> p (reveal r)) = let v : erased a = witness_exists () in v (*** Queue invariant ***) /// The invariant associated to the lock. Basically a variant of the /// Owicki-Gries invariant, but applied to queues [@@__reduce__] let lock_inv #a (ptr:ref (Q.t a)) (ghost:ghost_ref (Q.t a)) = h_exists (fun (v:Q.t a) -> pts_to ptr full v `star` ghost_pts_to ghost half v) let intro_lock_inv #a #u (ptr:ref (Q.t a)) (ghost:ghost_ref (Q.t a)) : SteelGhostT unit u (h_exists (fun (v:Q.t a) -> pts_to ptr full v `star` ghost_pts_to ghost half v)) (fun _ -> lock_inv ptr ghost) = assert_spinoff (h_exists (fun (v:Q.t a) -> pts_to ptr full v `star` ghost_pts_to ghost half v) == lock_inv ptr ghost); rewrite_slprop (h_exists (fun (v:Q.t a) -> pts_to ptr full v `star` ghost_pts_to ghost half v)) (lock_inv _ _) (fun _ -> ()) /// The type of a queue pointer. /// Contains the concrete pointer [ptr], the pointer to ghost state [ghost], /// and a lock [lock] protecting the invariant relating the concrete and ghost states noeq type q_ptr (a:Type) = { ptr : ref (Q.t a); ghost: ghost_ref (Q.t a); lock: lock (lock_inv ptr ghost); } /// The global queue invariant, which will be shared by the enqueuer and the dequeuer. /// Again, inspired by the Owicki-Gries counter: It contains half the permission for the ghost /// state of the enqueuer and dequeuer, while ensuring that the concrete queue always remains /// a valid queue let queue_invariant (#a:_) ([@@@smt_fallback]head:q_ptr a) ([@@@smt_fallback] tail:q_ptr a) = h_exists (fun (h:Q.t a) -> h_exists (fun (t:Q.t a) -> ghost_pts_to head.ghost half h `star` ghost_pts_to tail.ghost half t `star` Q.queue h t)) let pack_queue_invariant (#a:_) (#u:_) (x:erased (Q.t a)) (y:erased (Q.t a)) (head tail:q_ptr a) : SteelGhostT unit u (ghost_pts_to head.ghost half x `star` ghost_pts_to tail.ghost half y `star` Q.queue x y) (fun _ -> queue_invariant head tail) = intro_exists (reveal y) (fun y -> ghost_pts_to head.ghost half x `star` ghost_pts_to tail.ghost half y `star` Q.queue x y); intro_exists (reveal x) (fun x -> h_exists (fun y -> ghost_pts_to head.ghost half x `star` ghost_pts_to tail.ghost half y `star` Q.queue x y)) /// The type of a queue. It contains a head and tail pointers, each with their own ghost state, /// as well as the global queue invariant [inv]. Note that compared to the locks in the head and tail /// pointers with type `q_ptr`, since invariant is a true Steel invariant, only accessible inside /// atomic computations noeq type t (a:Type0) = { head : q_ptr a; tail : q_ptr a; inv : inv (queue_invariant head tail) }
{ "checked_file": "/", "dependencies": [ "Steel.Utils.fst.checked", "Steel.SpinLock.fsti.checked", "Steel.Reference.fsti.checked", "Steel.Memory.fsti.checked", "Steel.FractionalPermission.fst.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "Queue.fsti.checked", "prims.fst.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": false, "source_file": "TwoLockQueue.fst" }
[ { "abbrev": true, "full_module": "Queue", "short_module": "Q" }, { "abbrev": true, "full_module": "Steel.Utils", "short_module": "U" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": false, "full_module": "Steel.SpinLock", "short_module": null }, { "abbrev": false, "full_module": "Steel.Reference", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": true, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
x: a -> Steel.Effect.SteelT (TwoLockQueue.t a)
Steel.Effect.SteelT
[]
[]
[ "Steel.Effect.Atomic.return", "TwoLockQueue.t", "FStar.Ghost.hide", "FStar.Set.set", "Steel.Memory.iname", "FStar.Set.empty", "FStar.Algebra.CommMonoid.Equiv.__proj__CM__item__unit", "Steel.Effect.Common.vprop", "Steel.Effect.Common.req", "Steel.Effect.Common.rm", "TwoLockQueue.Mkt", "Steel.Effect.Common.inv", "TwoLockQueue.queue_invariant", "Steel.Effect.Atomic.new_invariant", "Prims.unit", "TwoLockQueue.pack_queue_invariant", "Queue.Def.t", "TwoLockQueue.q_ptr", "Queue.new_queue", "Steel.Effect.Common.emp", "Steel.Reference.ghost_pts_to", "TwoLockQueue.__proj__Mkq_ptr__item__ghost", "TwoLockQueue.half", "TwoLockQueue.Mkq_ptr", "Steel.SpinLock.lock", "TwoLockQueue.lock_inv", "Steel.SpinLock.new_lock", "Steel.Effect.Atomic.intro_exists", "Steel.Effect.Common.star", "Steel.Reference.pts_to", "TwoLockQueue.full", "Steel.Reference.ghost_share_pt", "Steel.FractionalPermission.full_perm", "Steel.Reference.ghost_ref", "Steel.Reference.ghost_alloc_pt", "Steel.Reference.ref", "Steel.Reference.alloc_pt" ]
[]
false
true
false
false
false
let new_queue (#a: _) (x: a) : SteelT (t a) emp (fun _ -> emp) =
let new_qptr (#a: _) (q: Q.t a) : SteelT (q_ptr a) emp (fun qp -> ghost_pts_to qp.ghost half q) = let ptr = alloc_pt q in let ghost = ghost_alloc_pt q in ghost_share_pt ghost; intro_exists _ (fun q -> (pts_to ptr full q) `star` (ghost_pts_to ghost half q)); let lock = Steel.SpinLock.new_lock _ in { ptr = ptr; ghost = ghost; lock = lock } in let hd = Q.new_queue x in let head = new_qptr hd in let tail = new_qptr hd in pack_queue_invariant (hide hd) (hide hd) head tail; let inv = new_invariant _ in return ({ head = head; tail = tail; inv = inv })
false
FStar.Issue.fsti
FStar.Issue.issue_level_string
val issue_level_string : Type0
let issue_level_string = s:string { s == "Info" \/ s == "Warning" \/ s == "Error" \/ s == "Feature not yet implemented: " }
{ "file_name": "ulib/FStar.Issue.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 1, "end_line": 14, "start_col": 0, "start_line": 9 }
module FStar.Issue open FStar.Range module Pprint = FStar.Stubs.Pprint new val issue : Type0
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Stubs.Pprint.fsti.checked", "FStar.Range.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.Issue.fsti" }
[ { "abbrev": true, "full_module": "FStar.Stubs.Pprint", "short_module": "Pprint" }, { "abbrev": false, "full_module": "FStar.Range", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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
Type0
Prims.Tot
[ "total" ]
[]
[ "Prims.string", "Prims.l_or", "Prims.eq2" ]
[]
false
false
false
true
true
let issue_level_string =
s: string{s == "Info" \/ s == "Warning" \/ s == "Error" \/ s == "Feature not yet implemented: "}
false
FStar.Issue.fsti
FStar.Issue.mk_issue
val mk_issue : i: FStar.Issue.issue_level_string -> msg: Prims.string -> range: FStar.Pervasives.Native.option FStar.Range.range -> number: FStar.Pervasives.Native.option Prims.int -> ctx: Prims.list Prims.string -> FStar.Issue.issue
let mk_issue (i:issue_level_string) (msg:string) (range:option range) (number:option int) (ctx:list string) = mk_issue_doc i [Pprint.arbitrary_string msg] range number ctx
{ "file_name": "ulib/FStar.Issue.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 65, "end_line": 49, "start_col": 0, "start_line": 44 }
module FStar.Issue open FStar.Range module Pprint = FStar.Stubs.Pprint new val issue : Type0 let issue_level_string = s:string { s == "Info" \/ s == "Warning" \/ s == "Error" \/ s == "Feature not yet implemented: " } val message_of_issue (i:issue) : Tot (list Pprint.document) val level_of_issue (i:issue) : Tot issue_level_string val number_of_issue (i:issue) : Tot (option int) val range_of_issue (i:issue) : Tot (option range) val context_of_issue (i:issue) : Tot (list string) val render_issue (i:issue) : Tot string (* NOTE: the only way to build a document that actually reduces in interpreted mode (like in tactics when not using plugins) is using arbitrary_string, as below. *) val mk_issue_doc (i:issue_level_string) (msg:list Pprint.document) (range:option range) (number:option int) (ctx:list string) : Tot issue (* These qualifiers here to make sure that karamel (while building krmllib) does not attempt to extract this definition, as that would fail since it does not have an implementation of arbitrary_string. We could also not extract this module altogether. *) noextract
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Stubs.Pprint.fsti.checked", "FStar.Range.fsti.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "FStar.Issue.fsti" }
[ { "abbrev": true, "full_module": "FStar.Stubs.Pprint", "short_module": "Pprint" }, { "abbrev": false, "full_module": "FStar.Range", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "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: FStar.Issue.issue_level_string -> msg: Prims.string -> range: FStar.Pervasives.Native.option FStar.Range.range -> number: FStar.Pervasives.Native.option Prims.int -> ctx: Prims.list Prims.string -> FStar.Issue.issue
Prims.Tot
[ "total" ]
[]
[ "FStar.Issue.issue_level_string", "Prims.string", "FStar.Pervasives.Native.option", "FStar.Range.range", "Prims.int", "Prims.list", "FStar.Issue.mk_issue_doc", "Prims.Cons", "FStar.Stubs.Pprint.document", "FStar.Stubs.Pprint.arbitrary_string", "Prims.Nil", "FStar.Issue.issue" ]
[]
false
false
false
true
false
let mk_issue (i: issue_level_string) (msg: string) (range: option range) (number: option int) (ctx: list string) =
mk_issue_doc i [Pprint.arbitrary_string msg] range number ctx
false
Hacl.Spec.Curve25519.Field64.Core.fst
Hacl.Spec.Curve25519.Field64.Core.felem
val felem : Type0
let felem = SD.lbignum U64 4
{ "file_name": "code/curve25519/Hacl.Spec.Curve25519.Field64.Core.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 28, "end_line": 19, "start_col": 0, "start_line": 19 }
module Hacl.Spec.Curve25519.Field64.Core open FStar.Mul open Lib.IntTypes open Lib.Sequence open Hacl.Spec.Curve25519.Field64.Definition module P = Spec.Curve25519 module CL = Hacl.Spec.Curve25519.Field64.Lemmas module SD = Hacl.Spec.Bignum.Definitions module SB = Hacl.Spec.Bignum #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0"
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Hacl.Spec.Curve25519.Field64.Lemmas.fst.checked", "Hacl.Spec.Curve25519.Field64.Definition.fst.checked", "Hacl.Spec.Bignum.Definitions.fst.checked", "Hacl.Spec.Bignum.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Curve25519.Field64.Core.fst" }
[ { "abbrev": true, "full_module": "Hacl.Spec.Bignum", "short_module": "SB" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Definitions", "short_module": "SD" }, { "abbrev": true, "full_module": "Hacl.Spec.Curve25519.Field64.Lemmas", "short_module": "CL" }, { "abbrev": true, "full_module": "Spec.Curve25519", "short_module": "P" }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field64.Definition", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field64", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Type0
Prims.Tot
[ "total" ]
[]
[ "Hacl.Spec.Bignum.Definitions.lbignum", "Lib.IntTypes.U64" ]
[]
false
false
false
true
true
let felem =
SD.lbignum U64 4
false
Hacl.Spec.Curve25519.Field64.Core.fst
Hacl.Spec.Curve25519.Field64.Core.mul1
val mul1: f:felem -> u:uint64 -> Pure (uint64 & felem) (requires True) (ensures fun (c, r) -> SD.bn_v r + v c * pow2 256 == SD.bn_v f * v u)
val mul1: f:felem -> u:uint64 -> Pure (uint64 & felem) (requires True) (ensures fun (c, r) -> SD.bn_v r + v c * pow2 256 == SD.bn_v f * v u)
let mul1 f u = let c, out = SB.bn_mul1 f u in SB.bn_mul1_lemma f u; c, out
{ "file_name": "code/curve25519/Hacl.Spec.Curve25519.Field64.Core.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 8, "end_line": 62, "start_col": 0, "start_line": 59 }
module Hacl.Spec.Curve25519.Field64.Core open FStar.Mul open Lib.IntTypes open Lib.Sequence open Hacl.Spec.Curve25519.Field64.Definition module P = Spec.Curve25519 module CL = Hacl.Spec.Curve25519.Field64.Lemmas module SD = Hacl.Spec.Bignum.Definitions module SB = Hacl.Spec.Bignum #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" unfold let felem = SD.lbignum U64 4 unfold let felem_wide = SD.lbignum U64 8 // let as_felem4 (e:felem) : felem4 = // (e.[0], e.[1], e.[2], e.[3]) // let as_nat (e:felem) = as_nat4 (as_felem4 e) val add1: f:felem -> cin:uint64 -> Pure (uint64 & felem) (requires True) (ensures fun (c, r) -> v c <= 1 /\ SD.bn_v r + v c * pow2 256 == SD.bn_v f + v cin) let add1 f cin = let (c, out) = SB.bn_add1 f cin in SB.bn_add1_lemma f cin; (c, out) val sub1: f:felem -> cin:uint64 -> Pure (uint64 & felem) (requires True) (ensures fun (c, r) -> v c <= 1 /\ SD.bn_v r - v c * pow2 256 == SD.bn_v f - v cin) let sub1 f cin = let c, out = SB.bn_sub1 f cin in SB.bn_sub1_lemma f cin; c, out val mul1: f:felem -> u:uint64 -> Pure (uint64 & felem) (requires True) (ensures fun (c, r) -> SD.bn_v r + v c * pow2 256 == SD.bn_v f * v u)
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Hacl.Spec.Curve25519.Field64.Lemmas.fst.checked", "Hacl.Spec.Curve25519.Field64.Definition.fst.checked", "Hacl.Spec.Bignum.Definitions.fst.checked", "Hacl.Spec.Bignum.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Curve25519.Field64.Core.fst" }
[ { "abbrev": true, "full_module": "Hacl.Spec.Bignum", "short_module": "SB" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Definitions", "short_module": "SD" }, { "abbrev": true, "full_module": "Hacl.Spec.Curve25519.Field64.Lemmas", "short_module": "CL" }, { "abbrev": true, "full_module": "Spec.Curve25519", "short_module": "P" }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field64.Definition", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field64", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": 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
f: Hacl.Spec.Curve25519.Field64.Core.felem -> u19: Lib.IntTypes.uint64 -> Prims.Pure (Lib.IntTypes.uint64 * Hacl.Spec.Curve25519.Field64.Core.felem)
Prims.Pure
[]
[]
[ "Hacl.Spec.Curve25519.Field64.Core.felem", "Lib.IntTypes.uint64", "Hacl.Spec.Bignum.Definitions.limb", "Lib.IntTypes.U64", "Hacl.Spec.Bignum.Definitions.lbignum", "FStar.Pervasives.Native.Mktuple2", "Prims.unit", "Hacl.Spec.Bignum.bn_mul1_lemma", "FStar.Pervasives.Native.tuple2", "Hacl.Spec.Bignum.bn_mul1" ]
[]
false
false
false
false
false
let mul1 f u =
let c, out = SB.bn_mul1 f u in SB.bn_mul1_lemma f u; c, out
false
Hacl.Spec.Curve25519.Field64.Core.fst
Hacl.Spec.Curve25519.Field64.Core.add4
val add4: f1:felem -> f2:felem -> Pure (uint64 & felem) (requires True) (ensures fun (c, r) -> v c <= 1 /\ SD.bn_v r + v c * pow2 256 == SD.bn_v f1 + SD.bn_v f2)
val add4: f1:felem -> f2:felem -> Pure (uint64 & felem) (requires True) (ensures fun (c, r) -> v c <= 1 /\ SD.bn_v r + v c * pow2 256 == SD.bn_v f1 + SD.bn_v f2)
let add4 f1 f2 = let c, out = SB.bn_add f1 f2 in SB.bn_add_lemma f1 f2; c, out
{ "file_name": "code/curve25519/Hacl.Spec.Curve25519.Field64.Core.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 8, "end_line": 172, "start_col": 0, "start_line": 169 }
module Hacl.Spec.Curve25519.Field64.Core open FStar.Mul open Lib.IntTypes open Lib.Sequence open Hacl.Spec.Curve25519.Field64.Definition module P = Spec.Curve25519 module CL = Hacl.Spec.Curve25519.Field64.Lemmas module SD = Hacl.Spec.Bignum.Definitions module SB = Hacl.Spec.Bignum #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" unfold let felem = SD.lbignum U64 4 unfold let felem_wide = SD.lbignum U64 8 // let as_felem4 (e:felem) : felem4 = // (e.[0], e.[1], e.[2], e.[3]) // let as_nat (e:felem) = as_nat4 (as_felem4 e) val add1: f:felem -> cin:uint64 -> Pure (uint64 & felem) (requires True) (ensures fun (c, r) -> v c <= 1 /\ SD.bn_v r + v c * pow2 256 == SD.bn_v f + v cin) let add1 f cin = let (c, out) = SB.bn_add1 f cin in SB.bn_add1_lemma f cin; (c, out) val sub1: f:felem -> cin:uint64 -> Pure (uint64 & felem) (requires True) (ensures fun (c, r) -> v c <= 1 /\ SD.bn_v r - v c * pow2 256 == SD.bn_v f - v cin) let sub1 f cin = let c, out = SB.bn_sub1 f cin in SB.bn_sub1_lemma f cin; c, out val mul1: f:felem -> u:uint64 -> Pure (uint64 & felem) (requires True) (ensures fun (c, r) -> SD.bn_v r + v c * pow2 256 == SD.bn_v f * v u) let mul1 f u = let c, out = SB.bn_mul1 f u in SB.bn_mul1_lemma f u; c, out val mul1_add: f1:felem -> u2:uint64 -> f3:felem -> Pure (uint64 & felem) (requires True) (ensures fun (c, r) -> SD.bn_v r + v c * pow2 256 == SD.bn_v f3 + SD.bn_v f1 * v u2) let mul1_add f1 u2 f3 = let c, out = SB.bn_mul1_lshift_add f1 u2 0 f3 in SB.bn_mul1_lshift_add_lemma f1 u2 0 f3; c, out val carry_pass: f:felem -> cin:uint64 -> felem let carry_pass f cin = let c, r = add1 f (cin *. u64 38) in let b1 = r.[0] +. c *. u64 38 in let out = r.[0] <- b1 in out val lemma_add1_carry: f:felem -> cin:uint64{v cin * 38 < pow2 63} -> Lemma (let c, r = add1 f (cin *! u64 38) in let b1 = r.[0] +. c *. u64 38 in v b1 == v r.[0] + v c * 38) let lemma_add1_carry f cin = let c, r = add1 f (cin *! u64 38) in let b1 = r.[0] +. c *. u64 38 in assert (SD.bn_v r + v c * pow2 256 == SD.bn_v f + v cin * 38); SD.bn_eval_split_i f 1; SD.bn_eval1 (slice f 0 1); //assert (SD.bn_v f == v f.[0] + pow2 64 * SD.bn_v (slice f 1 4)); SD.bn_eval_split_i r 1; SD.bn_eval1 (slice r 0 1); assert (v r.[0] + pow2 64 * SD.bn_v (slice r 1 4) + v c * pow2 256 == v f.[0] + pow2 64 * SD.bn_v (slice f 1 4) + v cin * 38); SD.bn_eval_bound (slice f 1 4) 3; SD.bn_eval_bound (slice r 1 4) 3; Math.Lemmas.pow2_plus 64 192; assert (v r.[0] == (v f.[0] + v cin * 38) % pow2 64) val carry_pass_lemma: f:felem -> cin:uint64{v cin * 38 < pow2 63} -> Lemma (SD.bn_v (carry_pass f cin) % P.prime == (SD.bn_v f + v cin * pow2 256) % P.prime) let carry_pass_lemma f cin = let c, r = add1 f (cin *! u64 38) in let b1 = r.[0] +. c *. u64 38 in let out = r.[0] <- b1 in SD.bn_upd_eval r b1 0; calc (==) { SD.bn_v out % P.prime; (==) { assert_norm (pow2 0 = 1) } (SD.bn_v r - v r.[0] + v b1) % P.prime; (==) { lemma_add1_carry f cin } (SD.bn_v r - v r.[0] + (v r.[0] + v c * 38)) % P.prime; (==) { } (SD.bn_v r + v c * 38) % P.prime; (==) { Lemmas.lemma_mul_pow256_add (SD.bn_v r) (v c) } (SD.bn_v r + v c * pow2 256) % P.prime; (==) { } (SD.bn_v f + v cin * 38) % P.prime; (==) { Lemmas.lemma_mul_pow256_add (SD.bn_v f) (v cin) } (SD.bn_v f + v cin * pow2 256) % P.prime; } val carry_wide: f:felem_wide -> Pure felem (requires True) (ensures fun out -> SD.bn_v out % P.prime == SD.bn_v f % P.prime) let carry_wide f = let c, r0 = mul1_add (sub f 4 4) (u64 38) (sub f 0 4) in assert (SD.bn_v r0 + v c * pow2 256 == SD.bn_v (sub f 0 4) + SD.bn_v (sub f 4 4) * 38); SD.bn_eval_bound (sub f 0 4) 4; SD.bn_eval_bound (sub f 4 4) 4; SD.bn_eval_bound r0 4; Lemmas.carry_wide_bound (SD.bn_v r0) (v c) (SD.bn_v (sub f 0 4)) (SD.bn_v (sub f 4 4)); let out = carry_pass r0 c in calc (==) { SD.bn_v out % P.prime; (==) { carry_pass_lemma r0 c } (SD.bn_v r0 + v c * pow2 256) % P.prime; (==) { } (SD.bn_v (sub f 0 4) + SD.bn_v (sub f 4 4) * 38) % P.prime; (==) { Lemmas.lemma_mul_pow256_add (SD.bn_v (sub f 0 4)) (SD.bn_v (sub f 4 4)) } (SD.bn_v (sub f 0 4) + SD.bn_v (sub f 4 4) * pow2 256) % P.prime; (==) { SD.bn_concat_lemma (sub f 0 4) (sub f 4 4) } SD.bn_v (concat (sub f 0 4) (sub f 4 4)) % P.prime; (==) { eq_intro f (concat (sub f 0 4) (sub f 4 4)) } SD.bn_v f % P.prime; }; out val add4: f1:felem -> f2:felem -> Pure (uint64 & felem) (requires True) (ensures fun (c, r) -> v c <= 1 /\ SD.bn_v r + v c * pow2 256 == SD.bn_v f1 + SD.bn_v f2)
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Hacl.Spec.Curve25519.Field64.Lemmas.fst.checked", "Hacl.Spec.Curve25519.Field64.Definition.fst.checked", "Hacl.Spec.Bignum.Definitions.fst.checked", "Hacl.Spec.Bignum.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Curve25519.Field64.Core.fst" }
[ { "abbrev": true, "full_module": "Hacl.Spec.Bignum", "short_module": "SB" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Definitions", "short_module": "SD" }, { "abbrev": true, "full_module": "Hacl.Spec.Curve25519.Field64.Lemmas", "short_module": "CL" }, { "abbrev": true, "full_module": "Spec.Curve25519", "short_module": "P" }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field64.Definition", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field64", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": 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
f1: Hacl.Spec.Curve25519.Field64.Core.felem -> f2: Hacl.Spec.Curve25519.Field64.Core.felem -> Prims.Pure (Lib.IntTypes.uint64 * Hacl.Spec.Curve25519.Field64.Core.felem)
Prims.Pure
[]
[]
[ "Hacl.Spec.Curve25519.Field64.Core.felem", "Hacl.Spec.Bignum.Base.carry", "Lib.IntTypes.U64", "Hacl.Spec.Bignum.Definitions.lbignum", "FStar.Pervasives.Native.Mktuple2", "Lib.IntTypes.uint64", "Prims.unit", "Hacl.Spec.Bignum.bn_add_lemma", "FStar.Pervasives.Native.tuple2", "Hacl.Spec.Bignum.bn_add" ]
[]
false
false
false
false
false
let add4 f1 f2 =
let c, out = SB.bn_add f1 f2 in SB.bn_add_lemma f1 f2; c, out
false
Hacl.Spec.Curve25519.Field64.Core.fst
Hacl.Spec.Curve25519.Field64.Core.felem_wide
val felem_wide : Type0
let felem_wide = SD.lbignum U64 8
{ "file_name": "code/curve25519/Hacl.Spec.Curve25519.Field64.Core.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 33, "end_line": 21, "start_col": 0, "start_line": 21 }
module Hacl.Spec.Curve25519.Field64.Core open FStar.Mul open Lib.IntTypes open Lib.Sequence open Hacl.Spec.Curve25519.Field64.Definition module P = Spec.Curve25519 module CL = Hacl.Spec.Curve25519.Field64.Lemmas module SD = Hacl.Spec.Bignum.Definitions module SB = Hacl.Spec.Bignum #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" unfold let felem = SD.lbignum U64 4
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Hacl.Spec.Curve25519.Field64.Lemmas.fst.checked", "Hacl.Spec.Curve25519.Field64.Definition.fst.checked", "Hacl.Spec.Bignum.Definitions.fst.checked", "Hacl.Spec.Bignum.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Curve25519.Field64.Core.fst" }
[ { "abbrev": true, "full_module": "Hacl.Spec.Bignum", "short_module": "SB" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Definitions", "short_module": "SD" }, { "abbrev": true, "full_module": "Hacl.Spec.Curve25519.Field64.Lemmas", "short_module": "CL" }, { "abbrev": true, "full_module": "Spec.Curve25519", "short_module": "P" }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field64.Definition", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field64", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
Type0
Prims.Tot
[ "total" ]
[]
[ "Hacl.Spec.Bignum.Definitions.lbignum", "Lib.IntTypes.U64" ]
[]
false
false
false
true
true
let felem_wide =
SD.lbignum U64 8
false
Hacl.Spec.Curve25519.Field64.Core.fst
Hacl.Spec.Curve25519.Field64.Core.carry_pass
val carry_pass: f:felem -> cin:uint64 -> felem
val carry_pass: f:felem -> cin:uint64 -> felem
let carry_pass f cin = let c, r = add1 f (cin *. u64 38) in let b1 = r.[0] +. c *. u64 38 in let out = r.[0] <- b1 in out
{ "file_name": "code/curve25519/Hacl.Spec.Curve25519.Field64.Core.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 5, "end_line": 82, "start_col": 0, "start_line": 78 }
module Hacl.Spec.Curve25519.Field64.Core open FStar.Mul open Lib.IntTypes open Lib.Sequence open Hacl.Spec.Curve25519.Field64.Definition module P = Spec.Curve25519 module CL = Hacl.Spec.Curve25519.Field64.Lemmas module SD = Hacl.Spec.Bignum.Definitions module SB = Hacl.Spec.Bignum #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" unfold let felem = SD.lbignum U64 4 unfold let felem_wide = SD.lbignum U64 8 // let as_felem4 (e:felem) : felem4 = // (e.[0], e.[1], e.[2], e.[3]) // let as_nat (e:felem) = as_nat4 (as_felem4 e) val add1: f:felem -> cin:uint64 -> Pure (uint64 & felem) (requires True) (ensures fun (c, r) -> v c <= 1 /\ SD.bn_v r + v c * pow2 256 == SD.bn_v f + v cin) let add1 f cin = let (c, out) = SB.bn_add1 f cin in SB.bn_add1_lemma f cin; (c, out) val sub1: f:felem -> cin:uint64 -> Pure (uint64 & felem) (requires True) (ensures fun (c, r) -> v c <= 1 /\ SD.bn_v r - v c * pow2 256 == SD.bn_v f - v cin) let sub1 f cin = let c, out = SB.bn_sub1 f cin in SB.bn_sub1_lemma f cin; c, out val mul1: f:felem -> u:uint64 -> Pure (uint64 & felem) (requires True) (ensures fun (c, r) -> SD.bn_v r + v c * pow2 256 == SD.bn_v f * v u) let mul1 f u = let c, out = SB.bn_mul1 f u in SB.bn_mul1_lemma f u; c, out val mul1_add: f1:felem -> u2:uint64 -> f3:felem -> Pure (uint64 & felem) (requires True) (ensures fun (c, r) -> SD.bn_v r + v c * pow2 256 == SD.bn_v f3 + SD.bn_v f1 * v u2) let mul1_add f1 u2 f3 = let c, out = SB.bn_mul1_lshift_add f1 u2 0 f3 in SB.bn_mul1_lshift_add_lemma f1 u2 0 f3; c, out
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Hacl.Spec.Curve25519.Field64.Lemmas.fst.checked", "Hacl.Spec.Curve25519.Field64.Definition.fst.checked", "Hacl.Spec.Bignum.Definitions.fst.checked", "Hacl.Spec.Bignum.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Curve25519.Field64.Core.fst" }
[ { "abbrev": true, "full_module": "Hacl.Spec.Bignum", "short_module": "SB" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Definitions", "short_module": "SD" }, { "abbrev": true, "full_module": "Hacl.Spec.Curve25519.Field64.Lemmas", "short_module": "CL" }, { "abbrev": true, "full_module": "Spec.Curve25519", "short_module": "P" }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field64.Definition", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field64", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": 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
f: Hacl.Spec.Curve25519.Field64.Core.felem -> cin: Lib.IntTypes.uint64 -> Hacl.Spec.Curve25519.Field64.Core.felem
Prims.Tot
[ "total" ]
[]
[ "Hacl.Spec.Curve25519.Field64.Core.felem", "Lib.IntTypes.uint64", "Lib.Sequence.lseq", "Hacl.Spec.Bignum.Definitions.limb", "Lib.IntTypes.U64", "Prims.l_and", "Prims.eq2", "FStar.Seq.Base.seq", "Lib.Sequence.to_seq", "FStar.Seq.Base.upd", "Lib.Sequence.index", "Prims.l_Forall", "Prims.nat", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_Subtraction", "Prims.pow2", "Prims.l_imp", "Prims.op_LessThan", "Prims.op_disEquality", "Prims.l_or", "FStar.Seq.Base.index", "Lib.Sequence.op_String_Assignment", "Lib.IntTypes.int_t", "Lib.IntTypes.SEC", "Lib.IntTypes.op_Plus_Dot", "Lib.Sequence.op_String_Access", "Lib.IntTypes.op_Star_Dot", "Lib.IntTypes.u64", "FStar.Pervasives.Native.tuple2", "Hacl.Spec.Bignum.Definitions.lbignum", "Hacl.Spec.Curve25519.Field64.Core.add1" ]
[]
false
false
false
true
false
let carry_pass f cin =
let c, r = add1 f (cin *. u64 38) in let b1 = r.[ 0 ] +. c *. u64 38 in let out = r.[ 0 ] <- b1 in out
false
Hacl.Spec.Curve25519.Field64.Core.fst
Hacl.Spec.Curve25519.Field64.Core.add1
val add1: f:felem -> cin:uint64 -> Pure (uint64 & felem) (requires True) (ensures fun (c, r) -> v c <= 1 /\ SD.bn_v r + v c * pow2 256 == SD.bn_v f + v cin)
val add1: f:felem -> cin:uint64 -> Pure (uint64 & felem) (requires True) (ensures fun (c, r) -> v c <= 1 /\ SD.bn_v r + v c * pow2 256 == SD.bn_v f + v cin)
let add1 f cin = let (c, out) = SB.bn_add1 f cin in SB.bn_add1_lemma f cin; (c, out)
{ "file_name": "code/curve25519/Hacl.Spec.Curve25519.Field64.Core.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 10, "end_line": 38, "start_col": 0, "start_line": 35 }
module Hacl.Spec.Curve25519.Field64.Core open FStar.Mul open Lib.IntTypes open Lib.Sequence open Hacl.Spec.Curve25519.Field64.Definition module P = Spec.Curve25519 module CL = Hacl.Spec.Curve25519.Field64.Lemmas module SD = Hacl.Spec.Bignum.Definitions module SB = Hacl.Spec.Bignum #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" unfold let felem = SD.lbignum U64 4 unfold let felem_wide = SD.lbignum U64 8 // let as_felem4 (e:felem) : felem4 = // (e.[0], e.[1], e.[2], e.[3]) // let as_nat (e:felem) = as_nat4 (as_felem4 e) val add1: f:felem -> cin:uint64 -> Pure (uint64 & felem) (requires True) (ensures fun (c, r) -> v c <= 1 /\ SD.bn_v r + v c * pow2 256 == SD.bn_v f + v cin)
{ "checked_file": "/", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Hacl.Spec.Curve25519.Field64.Lemmas.fst.checked", "Hacl.Spec.Curve25519.Field64.Definition.fst.checked", "Hacl.Spec.Bignum.Definitions.fst.checked", "Hacl.Spec.Bignum.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Curve25519.Field64.Core.fst" }
[ { "abbrev": true, "full_module": "Hacl.Spec.Bignum", "short_module": "SB" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Definitions", "short_module": "SD" }, { "abbrev": true, "full_module": "Hacl.Spec.Curve25519.Field64.Lemmas", "short_module": "CL" }, { "abbrev": true, "full_module": "Spec.Curve25519", "short_module": "P" }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field64.Definition", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field64", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Curve25519.Field64", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": 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
f: Hacl.Spec.Curve25519.Field64.Core.felem -> cin: Lib.IntTypes.uint64 -> Prims.Pure (Lib.IntTypes.uint64 * Hacl.Spec.Curve25519.Field64.Core.felem)
Prims.Pure
[]
[]
[ "Hacl.Spec.Curve25519.Field64.Core.felem", "Lib.IntTypes.uint64", "Hacl.Spec.Bignum.Base.carry", "Lib.IntTypes.U64", "Hacl.Spec.Bignum.Definitions.lbignum", "FStar.Pervasives.Native.Mktuple2", "Prims.unit", "Hacl.Spec.Bignum.bn_add1_lemma", "FStar.Pervasives.Native.tuple2", "Hacl.Spec.Bignum.bn_add1" ]
[]
false
false
false
false
false
let add1 f cin =
let c, out = SB.bn_add1 f cin in SB.bn_add1_lemma f cin; (c, out)
false