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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Vale.Stdcalls.X64.Aes.fsti | Vale.Stdcalls.X64.Aes.key128_post | val key128_post:VSig.vale_post dom | val key128_post:VSig.vale_post dom | let key128_post : VSig.vale_post dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
AE.va_ens_KeyExpansionStdcall c va_s0 IA.win AES_128 (as_vale_buffer input_b) (as_vale_buffer output_b) va_s1 f | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.Aes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 117,
"end_line": 66,
"start_col": 0,
"start_line": 59
} | module Vale.Stdcalls.X64.Aes
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
open Vale.AES.AES_s
module AE = Vale.AES.X64.AES
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__] noextract
let dom: IX64.arity_ok_stdcall td =
let y = [t128_no_mod; t128_mod] in
assert_norm (List.length y = 2);
y
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let key128_pre : VSig.vale_pre dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state) ->
AE.va_req_KeyExpansionStdcall c va_s0 IA.win AES_128
(as_vale_buffer input_b) (as_vale_buffer output_b) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.Aes.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.AES",
"short_module": "AE"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Vale.AsLowStar.ValeSig.vale_post Vale.Stdcalls.X64.Aes.dom | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_code",
"Vale.Stdcalls.X64.Aes.b128",
"Vale.X64.Decls.va_state",
"Vale.X64.Decls.va_fuel",
"Vale.AES.X64.AES.va_ens_KeyExpansionStdcall",
"Vale.Interop.Assumptions.win",
"Vale.AES.AES_common_s.AES_128",
"Vale.X64.MemoryAdapters.as_vale_buffer",
"Vale.Arch.HeapTypes_s.TUInt8",
"Vale.Arch.HeapTypes_s.TUInt128",
"Prims.prop"
] | [] | false | false | false | true | false | let key128_post:VSig.vale_post dom =
| fun
(c: V.va_code)
(input_b: b128)
(output_b: b128)
(va_s0: V.va_state)
(va_s1: V.va_state)
(f: V.va_fuel)
->
AE.va_ens_KeyExpansionStdcall c
va_s0
IA.win
AES_128
(as_vale_buffer input_b)
(as_vale_buffer output_b)
va_s1
f | false |
IfcRules.fst | IfcRules.seq_com | val seq_com : env:label_fun -> c1:com -> c2:com -> l:label ->
Lemma (requires (ni_com env c1 l /\ ni_com env c2 l))
(ensures (ni_com env (Seq c1 c2) l)) | val seq_com : env:label_fun -> c1:com -> c2:com -> l:label ->
Lemma (requires (ni_com env c1 l /\ ni_com env c2 l))
(ensures (ni_com env (Seq c1 c2) l)) | let seq_com env c1 c2 l = forall_intro
(fun (h0:rel (option heap)) ->
seq_com' env c1 c2 l h0 <: Lemma (ni_com' env (Seq c1 c2) l h0)) | {
"file_name": "examples/rel/IfcRules.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 71,
"end_line": 211,
"start_col": 0,
"start_line": 209
} | (*
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 IfcRules
open Rel
open While
open FStar.Heap
open FStar.Classical
open FStar.ST
(****************************** Preliminaries ******************************)
(* CH: Everything specialized to 2-point lattice *)
type label =
| Low
| High
val op_Less : label -> label -> Tot bool
let op_Less l1 l2 =
match l1, l2 with
| Low, High -> true
| _, _ -> false
val op_Less_Equals : label -> label -> Tot bool
let op_Less_Equals l1 l2 =
match l1, l2 with
| High, Low -> false
| _, _ -> true
val join : label -> label -> Tot label
let join l1 l2 =
match l1, l2 with
| Low, Low -> Low
| _, _ -> High
(*
* function from the addr_of refs to label
*)
type label_fun = nat -> GTot label
let label_of (env:label_fun) (r:id) :GTot label = env (addr_of r)
type low_equiv (env:label_fun) (h1:rel heap) =
forall (x:ref int). label_of env x = Low ==> sel (R?.l h1) x = sel (R?.r h1) x
(**************************** Typing Judgements ****************************)
(* env |- e : l
- Expressions do not modify the heap
- Correctness
- Low equivalent input heaps + Low label ==> same result
*)
type ni_exp (env:label_fun) (e:exp) (l:label) =
forall (h: rel heap).
(low_equiv env h /\ Low? l) ==>
(interpret_exp (R?.r h) e = interpret_exp (R?.l h) e)
(* env,pc:l |- c
- References with a label below l are not modified
- Total correctness
- Low equivalent input heaps ==> Low equivalent output heaps
*)
type ni_com' (env:label_fun) (c:com) (l:label) (h0: rel (option heap)) =
(Some? (R?.l h0) /\ Some? (R?.r h0) ==>
(let h0 = R (Some?.v (R?.l h0)) (Some?.v (R?.r h0)) in
let o_l = interpret_com (R?.l h0) c in
let o_r = interpret_com (R?.r h0) c in
((Some? o_l /\ Some? o_r /\ low_equiv env h0)
==> low_equiv env (R (Some?.v o_l) (Some?.v o_r)))))
/\
(Some? (R?.l h0) ==>
(let hl = Some?.v (R?.l h0) in
let o_l = interpret_com hl c in
(forall r. (label_of env r < l /\ Some? o_l)
==> sel hl r = sel (Some?.v o_l) r)))
/\
(Some? (R?.r h0) ==>
(let hr = Some?.v (R?.r h0) in
let o_r = interpret_com hr c in
(forall r. (label_of env r < l /\ Some? o_r)
==> sel hr r = sel (Some?.v o_r) r)))
type ni_com (env:label_fun) (c:com) (l:label) =
forall (h0: rel (option heap)). ni_com' env c l h0
(*********************** Typing Rules for Expressions **********************)
(* CH: The way we derive these rules looks more like a
semantically-justified program logic than a syntactic type
system. Any connection to Dave Naumann and Anindya Banerjee's
"relational logic"? (e.g. https://arxiv.org/abs/1611.08992) *)
(* Subtyping rule for expression labels
E |- e : l1 l1 <= l2
----------------------
E |- e : l2
*)
val sub_exp : env:label_fun -> e:exp -> l1:label -> l2:label{l1 <= l2} ->
Lemma (requires (ni_exp env e l1))
(ensures (ni_exp env e l2))
let sub_exp _ _ _ _ = ()
(* Typing rule for dereferencing
----------------
E | - r : E(r)
*)
val avar_exp : env:label_fun -> r:id ->
Lemma (requires True)
(ensures (ni_exp env (AVar r) (label_of env r)))
let avar_exp _ _ = ()
(* Typing rule for Int constants
i : int
-------
i : Low
*)
val aint_exp : env:label_fun -> i:int ->
Lemma (requires True)
(ensures (ni_exp env (AInt i) Low))
let aint_exp _ _ = ()
(* Typing rule for binary operators
e1 : l e2 : l
----------------
e1 `op` e2 : l
*)
val binop_exp : env:label_fun -> op:binop -> e1:exp -> e2:exp -> l:label ->
Lemma (requires (ni_exp env e1 l) /\ (ni_exp env e2 l))
(ensures (ni_exp env (AOp op e1 e2) l))
let binop_exp _ _ _ _ _ = ()
(************************ Typing Rules for Commands ************************)
(* Subtyping rule for commands
env,pc:l1 |- c l2 <= l1
---------------------------
env,pc:l2 |- c
*)
val sub_com : env:label_fun -> c:com -> l1:label -> l2:label{l2 <= l1} ->
Lemma (requires (ni_com env c l1 ))
(ensures (ni_com env c l2 ))
let sub_com _ _ _ _ = ()
(* Typing rule for assignment
env |- e : env(r)
------------------------
env, pc:env(r) |- r := e
- label of expression and context label have to be below label of r
(first one to prevent explicit, second to prevent implicit flows)
*)
val assign_com : env:label_fun -> e:exp -> r:id ->
Lemma (requires (ni_exp env e (label_of env r)))
(ensures (ni_com env (Assign r e) (label_of env r)))
let assign_com _ _ _ = ()
(* Sequencing rule for commands
env,pc:l |- c1 env,pc:l |- c2
------------------------------
env,pc:l |- c1; c2
*)
val seq_com' : env:label_fun -> c1:com -> c2:com -> l:label -> h0: rel (option heap) ->
Lemma (requires (ni_com env c1 l /\ ni_com env c2 l))
(ensures (ni_com' env (Seq c1 c2) l h0))
let seq_com' env c1 c2 l h0 =
match h0 with
| R None None -> ()
| R (Some hl) None -> cut (ni_com' env c2 l (R (interpret_com hl c1) None))
| R None (Some hr) -> cut (ni_com' env c2 l (R None (interpret_com hr c1)))
| R (Some hl) (Some hr) -> cut (ni_com' env c2 l (R (interpret_com hl c1) (interpret_com hr c1)))
val seq_com : env:label_fun -> c1:com -> c2:com -> l:label ->
Lemma (requires (ni_com env c1 l /\ ni_com env c2 l)) | {
"checked_file": "/",
"dependencies": [
"While.fst.checked",
"Rel.fst.checked",
"prims.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Heap.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "IfcRules.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Classical",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "While",
"short_module": null
},
{
"abbrev": false,
"full_module": "Rel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 | env: IfcRules.label_fun -> c1: While.com -> c2: While.com -> l: IfcRules.label
-> FStar.Pervasives.Lemma (requires IfcRules.ni_com env c1 l /\ IfcRules.ni_com env c2 l)
(ensures IfcRules.ni_com env (While.Seq c1 c2) l) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"IfcRules.label_fun",
"While.com",
"IfcRules.label",
"FStar.Classical.forall_intro",
"Rel.rel",
"FStar.Pervasives.Native.option",
"FStar.Monotonic.Heap.heap",
"IfcRules.ni_com'",
"While.Seq",
"IfcRules.seq_com'",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | false | false | true | false | false | let seq_com env c1 c2 l =
| forall_intro (fun (h0: rel (option heap)) ->
seq_com' env c1 c2 l h0 <: Lemma (ni_com' env (Seq c1 c2) l h0)) | false |
IfcRules.fst | IfcRules.seq_com' | val seq_com' : env:label_fun -> c1:com -> c2:com -> l:label -> h0: rel (option heap) ->
Lemma (requires (ni_com env c1 l /\ ni_com env c2 l))
(ensures (ni_com' env (Seq c1 c2) l h0)) | val seq_com' : env:label_fun -> c1:com -> c2:com -> l:label -> h0: rel (option heap) ->
Lemma (requires (ni_com env c1 l /\ ni_com env c2 l))
(ensures (ni_com' env (Seq c1 c2) l h0)) | let seq_com' env c1 c2 l h0 =
match h0 with
| R None None -> ()
| R (Some hl) None -> cut (ni_com' env c2 l (R (interpret_com hl c1) None))
| R None (Some hr) -> cut (ni_com' env c2 l (R None (interpret_com hr c1)))
| R (Some hl) (Some hr) -> cut (ni_com' env c2 l (R (interpret_com hl c1) (interpret_com hr c1))) | {
"file_name": "examples/rel/IfcRules.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 99,
"end_line": 204,
"start_col": 0,
"start_line": 199
} | (*
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 IfcRules
open Rel
open While
open FStar.Heap
open FStar.Classical
open FStar.ST
(****************************** Preliminaries ******************************)
(* CH: Everything specialized to 2-point lattice *)
type label =
| Low
| High
val op_Less : label -> label -> Tot bool
let op_Less l1 l2 =
match l1, l2 with
| Low, High -> true
| _, _ -> false
val op_Less_Equals : label -> label -> Tot bool
let op_Less_Equals l1 l2 =
match l1, l2 with
| High, Low -> false
| _, _ -> true
val join : label -> label -> Tot label
let join l1 l2 =
match l1, l2 with
| Low, Low -> Low
| _, _ -> High
(*
* function from the addr_of refs to label
*)
type label_fun = nat -> GTot label
let label_of (env:label_fun) (r:id) :GTot label = env (addr_of r)
type low_equiv (env:label_fun) (h1:rel heap) =
forall (x:ref int). label_of env x = Low ==> sel (R?.l h1) x = sel (R?.r h1) x
(**************************** Typing Judgements ****************************)
(* env |- e : l
- Expressions do not modify the heap
- Correctness
- Low equivalent input heaps + Low label ==> same result
*)
type ni_exp (env:label_fun) (e:exp) (l:label) =
forall (h: rel heap).
(low_equiv env h /\ Low? l) ==>
(interpret_exp (R?.r h) e = interpret_exp (R?.l h) e)
(* env,pc:l |- c
- References with a label below l are not modified
- Total correctness
- Low equivalent input heaps ==> Low equivalent output heaps
*)
type ni_com' (env:label_fun) (c:com) (l:label) (h0: rel (option heap)) =
(Some? (R?.l h0) /\ Some? (R?.r h0) ==>
(let h0 = R (Some?.v (R?.l h0)) (Some?.v (R?.r h0)) in
let o_l = interpret_com (R?.l h0) c in
let o_r = interpret_com (R?.r h0) c in
((Some? o_l /\ Some? o_r /\ low_equiv env h0)
==> low_equiv env (R (Some?.v o_l) (Some?.v o_r)))))
/\
(Some? (R?.l h0) ==>
(let hl = Some?.v (R?.l h0) in
let o_l = interpret_com hl c in
(forall r. (label_of env r < l /\ Some? o_l)
==> sel hl r = sel (Some?.v o_l) r)))
/\
(Some? (R?.r h0) ==>
(let hr = Some?.v (R?.r h0) in
let o_r = interpret_com hr c in
(forall r. (label_of env r < l /\ Some? o_r)
==> sel hr r = sel (Some?.v o_r) r)))
type ni_com (env:label_fun) (c:com) (l:label) =
forall (h0: rel (option heap)). ni_com' env c l h0
(*********************** Typing Rules for Expressions **********************)
(* CH: The way we derive these rules looks more like a
semantically-justified program logic than a syntactic type
system. Any connection to Dave Naumann and Anindya Banerjee's
"relational logic"? (e.g. https://arxiv.org/abs/1611.08992) *)
(* Subtyping rule for expression labels
E |- e : l1 l1 <= l2
----------------------
E |- e : l2
*)
val sub_exp : env:label_fun -> e:exp -> l1:label -> l2:label{l1 <= l2} ->
Lemma (requires (ni_exp env e l1))
(ensures (ni_exp env e l2))
let sub_exp _ _ _ _ = ()
(* Typing rule for dereferencing
----------------
E | - r : E(r)
*)
val avar_exp : env:label_fun -> r:id ->
Lemma (requires True)
(ensures (ni_exp env (AVar r) (label_of env r)))
let avar_exp _ _ = ()
(* Typing rule for Int constants
i : int
-------
i : Low
*)
val aint_exp : env:label_fun -> i:int ->
Lemma (requires True)
(ensures (ni_exp env (AInt i) Low))
let aint_exp _ _ = ()
(* Typing rule for binary operators
e1 : l e2 : l
----------------
e1 `op` e2 : l
*)
val binop_exp : env:label_fun -> op:binop -> e1:exp -> e2:exp -> l:label ->
Lemma (requires (ni_exp env e1 l) /\ (ni_exp env e2 l))
(ensures (ni_exp env (AOp op e1 e2) l))
let binop_exp _ _ _ _ _ = ()
(************************ Typing Rules for Commands ************************)
(* Subtyping rule for commands
env,pc:l1 |- c l2 <= l1
---------------------------
env,pc:l2 |- c
*)
val sub_com : env:label_fun -> c:com -> l1:label -> l2:label{l2 <= l1} ->
Lemma (requires (ni_com env c l1 ))
(ensures (ni_com env c l2 ))
let sub_com _ _ _ _ = ()
(* Typing rule for assignment
env |- e : env(r)
------------------------
env, pc:env(r) |- r := e
- label of expression and context label have to be below label of r
(first one to prevent explicit, second to prevent implicit flows)
*)
val assign_com : env:label_fun -> e:exp -> r:id ->
Lemma (requires (ni_exp env e (label_of env r)))
(ensures (ni_com env (Assign r e) (label_of env r)))
let assign_com _ _ _ = ()
(* Sequencing rule for commands
env,pc:l |- c1 env,pc:l |- c2
------------------------------
env,pc:l |- c1; c2
*)
val seq_com' : env:label_fun -> c1:com -> c2:com -> l:label -> h0: rel (option heap) ->
Lemma (requires (ni_com env c1 l /\ ni_com env c2 l)) | {
"checked_file": "/",
"dependencies": [
"While.fst.checked",
"Rel.fst.checked",
"prims.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Heap.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "IfcRules.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Classical",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "While",
"short_module": null
},
{
"abbrev": false,
"full_module": "Rel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 |
env: IfcRules.label_fun ->
c1: While.com ->
c2: While.com ->
l: IfcRules.label ->
h0: Rel.rel (FStar.Pervasives.Native.option FStar.Monotonic.Heap.heap)
-> FStar.Pervasives.Lemma (requires IfcRules.ni_com env c1 l /\ IfcRules.ni_com env c2 l)
(ensures IfcRules.ni_com' env (While.Seq c1 c2) l h0) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"IfcRules.label_fun",
"While.com",
"IfcRules.label",
"Rel.rel",
"FStar.Pervasives.Native.option",
"FStar.Monotonic.Heap.heap",
"Prims.cut",
"IfcRules.ni_com'",
"Rel.R",
"While.interpret_com",
"FStar.Pervasives.Native.None",
"Prims.unit"
] | [] | false | false | true | false | false | let seq_com' env c1 c2 l h0 =
| match h0 with
| R None None -> ()
| R (Some hl) None -> cut (ni_com' env c2 l (R (interpret_com hl c1) None))
| R None (Some hr) -> cut (ni_com' env c2 l (R None (interpret_com hr c1)))
| R (Some hl) (Some hr) -> cut (ni_com' env c2 l (R (interpret_com hl c1) (interpret_com hr c1))) | false |
Vale.Stdcalls.X64.Aes.fsti | Vale.Stdcalls.X64.Aes.key256_post | val key256_post:VSig.vale_post dom | val key256_post:VSig.vale_post dom | let key256_post : VSig.vale_post dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
AE.va_ens_KeyExpansionStdcall c va_s0 IA.win AES_256 (as_vale_buffer input_b) (as_vale_buffer output_b) va_s1 f | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.Aes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 117,
"end_line": 129,
"start_col": 0,
"start_line": 122
} | module Vale.Stdcalls.X64.Aes
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
open Vale.AES.AES_s
module AE = Vale.AES.X64.AES
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__] noextract
let dom: IX64.arity_ok_stdcall td =
let y = [t128_no_mod; t128_mod] in
assert_norm (List.length y = 2);
y
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let key128_pre : VSig.vale_pre dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state) ->
AE.va_req_KeyExpansionStdcall c va_s0 IA.win AES_128
(as_vale_buffer input_b) (as_vale_buffer output_b)
[@__reduce__] noextract
let key128_post : VSig.vale_post dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
AE.va_ens_KeyExpansionStdcall c va_s0 IA.win AES_128 (as_vale_buffer input_b) (as_vale_buffer output_b) va_s1 f
#set-options "--z3rlimit 20"
[@__reduce__] noextract
let key128_lemma'
(code:V.va_code)
(_win:bool)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
key128_pre code input_b output_b va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
key128_post code input_b output_b va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer input_b) /\
ME.buffer_writeable (as_vale_buffer output_b)
)) =
let va_s1, f = AE.va_lemma_KeyExpansionStdcall code va_s0 IA.win AES_128
(as_vale_buffer input_b) (as_vale_buffer output_b) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 input_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 output_b;
(va_s1, f)
noextract
let key128_lemma = as_t #(VSig.vale_sig_stdcall key128_pre key128_post) key128_lemma'
noextract
let code_key128 = AE.va_code_KeyExpansionStdcall IA.win AES_128
[@__reduce__] noextract
let lowstar_key128_t =
assert_norm (List.length dom + List.length ([]<:list arg) <= 4);
IX64.as_lowstar_sig_t_weak_stdcall
code_key128
dom
[]
_
_
(W.mk_prediction code_key128 dom [] (key128_lemma code_key128 IA.win))
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let key256_pre : VSig.vale_pre dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state) ->
AE.va_req_KeyExpansionStdcall c va_s0 IA.win AES_256
(as_vale_buffer input_b) (as_vale_buffer output_b) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.Aes.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.AES",
"short_module": "AE"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Vale.AsLowStar.ValeSig.vale_post Vale.Stdcalls.X64.Aes.dom | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_code",
"Vale.Stdcalls.X64.Aes.b128",
"Vale.X64.Decls.va_state",
"Vale.X64.Decls.va_fuel",
"Vale.AES.X64.AES.va_ens_KeyExpansionStdcall",
"Vale.Interop.Assumptions.win",
"Vale.AES.AES_common_s.AES_256",
"Vale.X64.MemoryAdapters.as_vale_buffer",
"Vale.Arch.HeapTypes_s.TUInt8",
"Vale.Arch.HeapTypes_s.TUInt128",
"Prims.prop"
] | [] | false | false | false | true | false | let key256_post:VSig.vale_post dom =
| fun
(c: V.va_code)
(input_b: b128)
(output_b: b128)
(va_s0: V.va_state)
(va_s1: V.va_state)
(f: V.va_fuel)
->
AE.va_ens_KeyExpansionStdcall c
va_s0
IA.win
AES_256
(as_vale_buffer input_b)
(as_vale_buffer output_b)
va_s1
f | false |
Vale.Stdcalls.X64.Aes.fsti | Vale.Stdcalls.X64.Aes.key256_pre | val key256_pre:VSig.vale_pre dom | val key256_pre:VSig.vale_pre dom | let key256_pre : VSig.vale_pre dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state) ->
AE.va_req_KeyExpansionStdcall c va_s0 IA.win AES_256
(as_vale_buffer input_b) (as_vale_buffer output_b) | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.Aes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 58,
"end_line": 119,
"start_col": 0,
"start_line": 113
} | module Vale.Stdcalls.X64.Aes
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
open Vale.AES.AES_s
module AE = Vale.AES.X64.AES
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__] noextract
let dom: IX64.arity_ok_stdcall td =
let y = [t128_no_mod; t128_mod] in
assert_norm (List.length y = 2);
y
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let key128_pre : VSig.vale_pre dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state) ->
AE.va_req_KeyExpansionStdcall c va_s0 IA.win AES_128
(as_vale_buffer input_b) (as_vale_buffer output_b)
[@__reduce__] noextract
let key128_post : VSig.vale_post dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
AE.va_ens_KeyExpansionStdcall c va_s0 IA.win AES_128 (as_vale_buffer input_b) (as_vale_buffer output_b) va_s1 f
#set-options "--z3rlimit 20"
[@__reduce__] noextract
let key128_lemma'
(code:V.va_code)
(_win:bool)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
key128_pre code input_b output_b va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
key128_post code input_b output_b va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer input_b) /\
ME.buffer_writeable (as_vale_buffer output_b)
)) =
let va_s1, f = AE.va_lemma_KeyExpansionStdcall code va_s0 IA.win AES_128
(as_vale_buffer input_b) (as_vale_buffer output_b) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 input_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 output_b;
(va_s1, f)
noextract
let key128_lemma = as_t #(VSig.vale_sig_stdcall key128_pre key128_post) key128_lemma'
noextract
let code_key128 = AE.va_code_KeyExpansionStdcall IA.win AES_128
[@__reduce__] noextract
let lowstar_key128_t =
assert_norm (List.length dom + List.length ([]<:list arg) <= 4);
IX64.as_lowstar_sig_t_weak_stdcall
code_key128
dom
[]
_
_
(W.mk_prediction code_key128 dom [] (key128_lemma code_key128 IA.win))
(* Need to rearrange the order of arguments *) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.Aes.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.AES",
"short_module": "AE"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Vale.AsLowStar.ValeSig.vale_pre Vale.Stdcalls.X64.Aes.dom | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_code",
"Vale.Stdcalls.X64.Aes.b128",
"Vale.X64.Decls.va_state",
"Vale.AES.X64.AES.va_req_KeyExpansionStdcall",
"Vale.Interop.Assumptions.win",
"Vale.AES.AES_common_s.AES_256",
"Vale.X64.MemoryAdapters.as_vale_buffer",
"Vale.Arch.HeapTypes_s.TUInt8",
"Vale.Arch.HeapTypes_s.TUInt128",
"Prims.prop"
] | [] | false | false | false | true | false | let key256_pre:VSig.vale_pre dom =
| fun (c: V.va_code) (input_b: b128) (output_b: b128) (va_s0: V.va_state) ->
AE.va_req_KeyExpansionStdcall c
va_s0
IA.win
AES_256
(as_vale_buffer input_b)
(as_vale_buffer output_b) | false |
Vale.Stdcalls.X64.Aes.fsti | Vale.Stdcalls.X64.Aes.code_key128 | val code_key128 : Vale.X64.Decls.va_code | let code_key128 = AE.va_code_KeyExpansionStdcall IA.win AES_128 | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.Aes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 63,
"end_line": 97,
"start_col": 0,
"start_line": 97
} | module Vale.Stdcalls.X64.Aes
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
open Vale.AES.AES_s
module AE = Vale.AES.X64.AES
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__] noextract
let dom: IX64.arity_ok_stdcall td =
let y = [t128_no_mod; t128_mod] in
assert_norm (List.length y = 2);
y
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let key128_pre : VSig.vale_pre dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state) ->
AE.va_req_KeyExpansionStdcall c va_s0 IA.win AES_128
(as_vale_buffer input_b) (as_vale_buffer output_b)
[@__reduce__] noextract
let key128_post : VSig.vale_post dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
AE.va_ens_KeyExpansionStdcall c va_s0 IA.win AES_128 (as_vale_buffer input_b) (as_vale_buffer output_b) va_s1 f
#set-options "--z3rlimit 20"
[@__reduce__] noextract
let key128_lemma'
(code:V.va_code)
(_win:bool)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
key128_pre code input_b output_b va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
key128_post code input_b output_b va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer input_b) /\
ME.buffer_writeable (as_vale_buffer output_b)
)) =
let va_s1, f = AE.va_lemma_KeyExpansionStdcall code va_s0 IA.win AES_128
(as_vale_buffer input_b) (as_vale_buffer output_b) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 input_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 output_b;
(va_s1, f)
noextract
let key128_lemma = as_t #(VSig.vale_sig_stdcall key128_pre key128_post) key128_lemma' | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.Aes.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.AES",
"short_module": "AE"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Vale.X64.Decls.va_code | Prims.Tot | [
"total"
] | [] | [
"Vale.AES.X64.AES.va_code_KeyExpansionStdcall",
"Vale.Interop.Assumptions.win",
"Vale.AES.AES_common_s.AES_128"
] | [] | false | false | false | true | false | let code_key128 =
| AE.va_code_KeyExpansionStdcall IA.win AES_128 | false |
|
Vale.Stdcalls.X64.Aes.fsti | Vale.Stdcalls.X64.Aes.code_key256 | val code_key256 : Vale.X64.Decls.va_code | let code_key256 = AE.va_code_KeyExpansionStdcall IA.win AES_256 | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.Aes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 63,
"end_line": 160,
"start_col": 0,
"start_line": 160
} | module Vale.Stdcalls.X64.Aes
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
open Vale.AES.AES_s
module AE = Vale.AES.X64.AES
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__] noextract
let dom: IX64.arity_ok_stdcall td =
let y = [t128_no_mod; t128_mod] in
assert_norm (List.length y = 2);
y
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let key128_pre : VSig.vale_pre dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state) ->
AE.va_req_KeyExpansionStdcall c va_s0 IA.win AES_128
(as_vale_buffer input_b) (as_vale_buffer output_b)
[@__reduce__] noextract
let key128_post : VSig.vale_post dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
AE.va_ens_KeyExpansionStdcall c va_s0 IA.win AES_128 (as_vale_buffer input_b) (as_vale_buffer output_b) va_s1 f
#set-options "--z3rlimit 20"
[@__reduce__] noextract
let key128_lemma'
(code:V.va_code)
(_win:bool)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
key128_pre code input_b output_b va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
key128_post code input_b output_b va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer input_b) /\
ME.buffer_writeable (as_vale_buffer output_b)
)) =
let va_s1, f = AE.va_lemma_KeyExpansionStdcall code va_s0 IA.win AES_128
(as_vale_buffer input_b) (as_vale_buffer output_b) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 input_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 output_b;
(va_s1, f)
noextract
let key128_lemma = as_t #(VSig.vale_sig_stdcall key128_pre key128_post) key128_lemma'
noextract
let code_key128 = AE.va_code_KeyExpansionStdcall IA.win AES_128
[@__reduce__] noextract
let lowstar_key128_t =
assert_norm (List.length dom + List.length ([]<:list arg) <= 4);
IX64.as_lowstar_sig_t_weak_stdcall
code_key128
dom
[]
_
_
(W.mk_prediction code_key128 dom [] (key128_lemma code_key128 IA.win))
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let key256_pre : VSig.vale_pre dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state) ->
AE.va_req_KeyExpansionStdcall c va_s0 IA.win AES_256
(as_vale_buffer input_b) (as_vale_buffer output_b)
[@__reduce__] noextract
let key256_post : VSig.vale_post dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
AE.va_ens_KeyExpansionStdcall c va_s0 IA.win AES_256 (as_vale_buffer input_b) (as_vale_buffer output_b) va_s1 f
#set-options "--z3rlimit 20"
[@__reduce__] noextract
let key256_lemma'
(code:V.va_code)
(_win:bool)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
key256_pre code input_b output_b va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
key256_post code input_b output_b va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer input_b) /\
ME.buffer_writeable (as_vale_buffer output_b)
)) =
let va_s1, f = AE.va_lemma_KeyExpansionStdcall code va_s0 IA.win AES_256
(as_vale_buffer input_b) (as_vale_buffer output_b) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 input_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 output_b;
(va_s1, f)
noextract
let key256_lemma = as_t #(VSig.vale_sig_stdcall key256_pre key256_post) key256_lemma' | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.Aes.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.AES",
"short_module": "AE"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Vale.X64.Decls.va_code | Prims.Tot | [
"total"
] | [] | [
"Vale.AES.X64.AES.va_code_KeyExpansionStdcall",
"Vale.Interop.Assumptions.win",
"Vale.AES.AES_common_s.AES_256"
] | [] | false | false | false | true | false | let code_key256 =
| AE.va_code_KeyExpansionStdcall IA.win AES_256 | false |
|
Steel.ArrayArith.fsti | Steel.ArrayArith.same_base_array | val same_base_array (#a: Type) (arr1 arr2: array a) : prop | val same_base_array (#a: Type) (arr1 arr2: array a) : prop | let same_base_array (#a:Type) (arr1 arr2: array a) : prop
= base (ptr_of arr1) == base (ptr_of arr2) | {
"file_name": "lib/steel/Steel.ArrayArith.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 43,
"end_line": 24,
"start_col": 0,
"start_line": 23
} | module Steel.ArrayArith
open Steel.FractionalPermission
open Steel.Effect.Atomic
open Steel.Effect
open Steel.ST.Array
open Steel.Array
(* This module provides a very restricted way of doing pointer arithmetic comparison on Steel arrays.
Primitives in this module are considered builtins by karamel, and have handwritten C implementations.
Clients using this module should extract with the krml options
`-static-header Steel.ArrayArith -no-prefix Steel.ArrayArith`
*)
/// The main predicate of this module. `within_bounds` captures that [p] is part of the same
/// allocation unit as [arr1] and [arr2], and situated in between. It is an abstract predicate,
/// that can only be introduced by the `within_bounds_intro` function below.
val within_bounds (#a: Type) (arr1 p arr2: array a) : prop
/// An abbreviation capturing that [arr1] and [arr2] belong to the same array,
/// and hence to the same allocation unit according to the Steel memory model | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Array.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"Steel.Array.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Steel.ArrayArith.fsti"
} | [
{
"abbrev": false,
"full_module": "Steel.Array",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Array",
"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.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | arr1: Steel.ST.Array.array a -> arr2: Steel.ST.Array.array a -> Prims.prop | Prims.Tot | [
"total"
] | [] | [
"Steel.ST.Array.array",
"Prims.eq2",
"Steel.ST.Array.base_t",
"Steel.ST.Array.base",
"Steel.ST.Array.ptr_of",
"Prims.prop"
] | [] | false | false | false | true | true | let same_base_array (#a: Type) (arr1 arr2: array a) : prop =
| base (ptr_of arr1) == base (ptr_of arr2) | false |
IfcRules.fst | IfcRules.while_com' | val while_com' : env:label_fun -> e:exp -> c:com -> v:variant -> l:label -> h:rel (option heap) ->
Lemma (requires (ni_exp env e l /\ ni_com env c l))
(ensures (ni_com' env (While e c v) l h))
(decreases (decr_while (R?.l h) v + decr_while (R?.r h) v)) | val while_com' : env:label_fun -> e:exp -> c:com -> v:variant -> l:label -> h:rel (option heap) ->
Lemma (requires (ni_exp env e l /\ ni_com env c l))
(ensures (ni_com' env (While e c v) l h))
(decreases (decr_while (R?.l h) v + decr_while (R?.r h) v)) | let rec while_com' env e c v l h =
// Interpret the body
match h with
| R None None -> ()
| R (Some h_l) None ->
begin
let o_l = interpret_com h_l c in
match o_l with
| Some hl ->
if (interpret_exp h_l v > interpret_exp hl v) && interpret_exp hl v >= 0 then
while_com' env e c v l (R o_l None)
else
()
| None -> ()
end
| R None (Some h_r) ->
begin
let o_r = interpret_com h_r c in
match o_r with
| Some hr ->
if (interpret_exp h_r v > interpret_exp hr v) && interpret_exp hr v >= 0 then
while_com' env e c v l (R None o_r)
else
()
| None -> ()
end
| R (Some h_l) (Some h_r) ->
begin
let o_l = interpret_com h_l c in
let o_r = interpret_com h_r c in
(* Case analysis on termination of bodies *)
match o_l, o_r with
| Some hl , Some hr ->
begin
// case analysis on decreasing of variant
match (interpret_exp h_l v > interpret_exp hl v) && interpret_exp hl v >= 0 ,
(interpret_exp h_r v > interpret_exp hr v) && interpret_exp hr v >= 0 with
| true , true -> while_com' env e c v l (R o_l o_r)
| true , false -> while_com' env e c v l (R o_l (Some h_r))
| false , true -> while_com' env e c v l (R (Some h_l) o_r )
| false, false -> ()
end
| Some hl , None ->
if (interpret_exp h_l v > interpret_exp hl v) && interpret_exp hl v >= 0 then
while_com' env e c v l (R o_l (Some h_r))
| None , Some hr ->
if (interpret_exp h_r v > interpret_exp hr v) && interpret_exp hr v >= 0 then
while_com' env e c v l (R (Some h_l) o_r)
| None, None -> ()
end | {
"file_name": "examples/rel/IfcRules.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 5,
"end_line": 307,
"start_col": 0,
"start_line": 257
} | (*
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 IfcRules
open Rel
open While
open FStar.Heap
open FStar.Classical
open FStar.ST
(****************************** Preliminaries ******************************)
(* CH: Everything specialized to 2-point lattice *)
type label =
| Low
| High
val op_Less : label -> label -> Tot bool
let op_Less l1 l2 =
match l1, l2 with
| Low, High -> true
| _, _ -> false
val op_Less_Equals : label -> label -> Tot bool
let op_Less_Equals l1 l2 =
match l1, l2 with
| High, Low -> false
| _, _ -> true
val join : label -> label -> Tot label
let join l1 l2 =
match l1, l2 with
| Low, Low -> Low
| _, _ -> High
(*
* function from the addr_of refs to label
*)
type label_fun = nat -> GTot label
let label_of (env:label_fun) (r:id) :GTot label = env (addr_of r)
type low_equiv (env:label_fun) (h1:rel heap) =
forall (x:ref int). label_of env x = Low ==> sel (R?.l h1) x = sel (R?.r h1) x
(**************************** Typing Judgements ****************************)
(* env |- e : l
- Expressions do not modify the heap
- Correctness
- Low equivalent input heaps + Low label ==> same result
*)
type ni_exp (env:label_fun) (e:exp) (l:label) =
forall (h: rel heap).
(low_equiv env h /\ Low? l) ==>
(interpret_exp (R?.r h) e = interpret_exp (R?.l h) e)
(* env,pc:l |- c
- References with a label below l are not modified
- Total correctness
- Low equivalent input heaps ==> Low equivalent output heaps
*)
type ni_com' (env:label_fun) (c:com) (l:label) (h0: rel (option heap)) =
(Some? (R?.l h0) /\ Some? (R?.r h0) ==>
(let h0 = R (Some?.v (R?.l h0)) (Some?.v (R?.r h0)) in
let o_l = interpret_com (R?.l h0) c in
let o_r = interpret_com (R?.r h0) c in
((Some? o_l /\ Some? o_r /\ low_equiv env h0)
==> low_equiv env (R (Some?.v o_l) (Some?.v o_r)))))
/\
(Some? (R?.l h0) ==>
(let hl = Some?.v (R?.l h0) in
let o_l = interpret_com hl c in
(forall r. (label_of env r < l /\ Some? o_l)
==> sel hl r = sel (Some?.v o_l) r)))
/\
(Some? (R?.r h0) ==>
(let hr = Some?.v (R?.r h0) in
let o_r = interpret_com hr c in
(forall r. (label_of env r < l /\ Some? o_r)
==> sel hr r = sel (Some?.v o_r) r)))
type ni_com (env:label_fun) (c:com) (l:label) =
forall (h0: rel (option heap)). ni_com' env c l h0
(*********************** Typing Rules for Expressions **********************)
(* CH: The way we derive these rules looks more like a
semantically-justified program logic than a syntactic type
system. Any connection to Dave Naumann and Anindya Banerjee's
"relational logic"? (e.g. https://arxiv.org/abs/1611.08992) *)
(* Subtyping rule for expression labels
E |- e : l1 l1 <= l2
----------------------
E |- e : l2
*)
val sub_exp : env:label_fun -> e:exp -> l1:label -> l2:label{l1 <= l2} ->
Lemma (requires (ni_exp env e l1))
(ensures (ni_exp env e l2))
let sub_exp _ _ _ _ = ()
(* Typing rule for dereferencing
----------------
E | - r : E(r)
*)
val avar_exp : env:label_fun -> r:id ->
Lemma (requires True)
(ensures (ni_exp env (AVar r) (label_of env r)))
let avar_exp _ _ = ()
(* Typing rule for Int constants
i : int
-------
i : Low
*)
val aint_exp : env:label_fun -> i:int ->
Lemma (requires True)
(ensures (ni_exp env (AInt i) Low))
let aint_exp _ _ = ()
(* Typing rule for binary operators
e1 : l e2 : l
----------------
e1 `op` e2 : l
*)
val binop_exp : env:label_fun -> op:binop -> e1:exp -> e2:exp -> l:label ->
Lemma (requires (ni_exp env e1 l) /\ (ni_exp env e2 l))
(ensures (ni_exp env (AOp op e1 e2) l))
let binop_exp _ _ _ _ _ = ()
(************************ Typing Rules for Commands ************************)
(* Subtyping rule for commands
env,pc:l1 |- c l2 <= l1
---------------------------
env,pc:l2 |- c
*)
val sub_com : env:label_fun -> c:com -> l1:label -> l2:label{l2 <= l1} ->
Lemma (requires (ni_com env c l1 ))
(ensures (ni_com env c l2 ))
let sub_com _ _ _ _ = ()
(* Typing rule for assignment
env |- e : env(r)
------------------------
env, pc:env(r) |- r := e
- label of expression and context label have to be below label of r
(first one to prevent explicit, second to prevent implicit flows)
*)
val assign_com : env:label_fun -> e:exp -> r:id ->
Lemma (requires (ni_exp env e (label_of env r)))
(ensures (ni_com env (Assign r e) (label_of env r)))
let assign_com _ _ _ = ()
(* Sequencing rule for commands
env,pc:l |- c1 env,pc:l |- c2
------------------------------
env,pc:l |- c1; c2
*)
val seq_com' : env:label_fun -> c1:com -> c2:com -> l:label -> h0: rel (option heap) ->
Lemma (requires (ni_com env c1 l /\ ni_com env c2 l))
(ensures (ni_com' env (Seq c1 c2) l h0))
let seq_com' env c1 c2 l h0 =
match h0 with
| R None None -> ()
| R (Some hl) None -> cut (ni_com' env c2 l (R (interpret_com hl c1) None))
| R None (Some hr) -> cut (ni_com' env c2 l (R None (interpret_com hr c1)))
| R (Some hl) (Some hr) -> cut (ni_com' env c2 l (R (interpret_com hl c1) (interpret_com hr c1)))
val seq_com : env:label_fun -> c1:com -> c2:com -> l:label ->
Lemma (requires (ni_com env c1 l /\ ni_com env c2 l))
(ensures (ni_com env (Seq c1 c2) l))
let seq_com env c1 c2 l = forall_intro
(fun (h0:rel (option heap)) ->
seq_com' env c1 c2 l h0 <: Lemma (ni_com' env (Seq c1 c2) l h0))
(* Typing rule for conditional commands
env |- e : l env,pc:l |- ct env,pc:l |- cf
----------------------------------------------
env,pc:l |- if e <> 0 then ct else cf
*)
val cond_com : env:label_fun -> e:exp -> ct:com -> cf:com -> l:label ->
Lemma (requires ((ni_exp env e l) /\ (ni_com env ct l) /\ (ni_com env cf l)))
(ensures (ni_com env (If e ct cf) l))
let cond_com _ _ _ _ _ = ()
(* Typing rule for Skip
-------------------
env,pc:High |- skip
*)
val skip_com : env:label_fun ->
Lemma (ni_com env Skip High)
let skip_com _ = ()
(* While rule for commands
env |- e : l env,pc:l |- c
-----------------------------------
env,pc:l |- while (e <> 0) do c
*)
(* slight variant taking option heap *)
val decr_while : h:(option heap) -> v:variant -> GTot nat
let decr_while h v = match h with
| None -> 0
| Some h0 ->
let tmp = interpret_exp h0 v in
if 0 > tmp then 0 else tmp
#reset-options "--z3rlimit 30"
val while_com' : env:label_fun -> e:exp -> c:com -> v:variant -> l:label -> h:rel (option heap) ->
Lemma (requires (ni_exp env e l /\ ni_com env c l))
(ensures (ni_com' env (While e c v) l h)) | {
"checked_file": "/",
"dependencies": [
"While.fst.checked",
"Rel.fst.checked",
"prims.fst.checked",
"FStar.ST.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Heap.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "IfcRules.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Classical",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "While",
"short_module": null
},
{
"abbrev": false,
"full_module": "Rel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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": 30,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
env: IfcRules.label_fun ->
e: While.exp ->
c: While.com ->
v: While.variant ->
l: IfcRules.label ->
h: Rel.rel (FStar.Pervasives.Native.option FStar.Monotonic.Heap.heap)
-> FStar.Pervasives.Lemma (requires IfcRules.ni_exp env e l /\ IfcRules.ni_com env c l)
(ensures IfcRules.ni_com' env (While.While e c v) l h)
(decreases IfcRules.decr_while (R?.l h) v + IfcRules.decr_while (R?.r h) v) | FStar.Pervasives.Lemma | [
"lemma",
""
] | [] | [
"IfcRules.label_fun",
"While.exp",
"While.com",
"While.variant",
"IfcRules.label",
"Rel.rel",
"FStar.Pervasives.Native.option",
"FStar.Monotonic.Heap.heap",
"Prims.op_AmpAmp",
"Prims.op_GreaterThan",
"While.interpret_exp",
"Prims.op_GreaterThanOrEqual",
"IfcRules.while_com'",
"Rel.R",
"FStar.Pervasives.Native.None",
"Prims.bool",
"Prims.unit",
"While.interpret_com",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Pervasives.Native.Some"
] | [
"recursion"
] | false | false | true | false | false | let rec while_com' env e c v l h =
| match h with
| R None None -> ()
| R (Some h_l) None ->
let o_l = interpret_com h_l c in
(match o_l with
| Some hl ->
if (interpret_exp h_l v > interpret_exp hl v) && interpret_exp hl v >= 0
then while_com' env e c v l (R o_l None)
| None -> ())
| R None (Some h_r) ->
let o_r = interpret_com h_r c in
(match o_r with
| Some hr ->
if (interpret_exp h_r v > interpret_exp hr v) && interpret_exp hr v >= 0
then while_com' env e c v l (R None o_r)
| None -> ())
| R (Some h_l) (Some h_r) ->
let o_l = interpret_com h_l c in
let o_r = interpret_com h_r c in
match o_l, o_r with
| Some hl, Some hr ->
(match
(interpret_exp h_l v > interpret_exp hl v) && interpret_exp hl v >= 0,
(interpret_exp h_r v > interpret_exp hr v) && interpret_exp hr v >= 0
with
| true, true -> while_com' env e c v l (R o_l o_r)
| true, false -> while_com' env e c v l (R o_l (Some h_r))
| false, true -> while_com' env e c v l (R (Some h_l) o_r)
| false, false -> ())
| Some hl, None ->
if (interpret_exp h_l v > interpret_exp hl v) && interpret_exp hl v >= 0
then while_com' env e c v l (R o_l (Some h_r))
| None, Some hr ->
if (interpret_exp h_r v > interpret_exp hr v) && interpret_exp hr v >= 0
then while_com' env e c v l (R (Some h_l) o_r)
| None, None -> () | false |
Vale.Stdcalls.X64.Aes.fsti | Vale.Stdcalls.X64.Aes.as_normal_t | val as_normal_t (#a: Type) (x: a) : normal a | val as_normal_t (#a: Type) (x: a) : normal a | let as_normal_t (#a:Type) (x:a) : normal a = x | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.Aes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 46,
"end_line": 33,
"start_col": 0,
"start_line": 33
} | module Vale.Stdcalls.X64.Aes
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
open Vale.AES.AES_s
module AE = Vale.AES.X64.AES
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.Aes.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.AES",
"short_module": "AE"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x: a -> Vale.Interop.Base.normal a | Prims.Tot | [
"total"
] | [] | [
"Vale.Interop.Base.normal"
] | [] | false | false | false | true | false | let as_normal_t (#a: Type) (x: a) : normal a =
| x | false |
FStar.Tactics.NamedView.fsti | FStar.Tactics.NamedView.notAscription | val notAscription (tv: named_term_view) : bool | val notAscription (tv: named_term_view) : bool | let notAscription (tv:named_term_view) : bool =
not (Tv_AscribedT? tv) && not (Tv_AscribedC? tv) | {
"file_name": "ulib/FStar.Tactics.NamedView.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 50,
"end_line": 114,
"start_col": 0,
"start_line": 113
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.NamedView
open FStar.Tactics.Effect
open FStar.Reflection.V2
module R = FStar.Reflection.V2
(* Re export the syntax types. Expose variables as their views, users do
not need to pack/inspect these if they are using the named view. *)
type namedv = R.namedv_view
type bv = R.bv_view
type comp = R.comp_view
type binding = R.binding (* already good *)
(* Terms and universes are still *deep*, so we do not change their
representation, and the user needs to pack/inspect. *)
type term = R.term
type universe = R.universe
[@@plugin]
noeq
type binder = {
uniq : nat;
ppname : ppname_t;
sort : R.typ;
qual : aqualv;
attrs : list term;
}
type binders = list binder
let is_simple_binder (b:binder) = Q_Explicit? b.qual /\ Nil? b.attrs
type simple_binder = b:binder{is_simple_binder b}
type univ_name = string & Range.range
[@@plugin]
noeq
type named_universe_view =
| Uv_Zero : named_universe_view
| Uv_Succ : universe -> named_universe_view
| Uv_Max : universes -> named_universe_view
| Uv_BVar : nat -> named_universe_view
| Uv_Name : univ_name -> named_universe_view
| Uv_Unif : R.universe_uvar -> named_universe_view
| Uv_Unk : named_universe_view
[@@plugin]
noeq
type pattern =
// A built-in constant
| Pat_Constant {
c : vconst
}
// A fully applied constructor, each boolean marks whether the
// argument was an explicitly-provided implicit argument
| Pat_Cons {
head : fv;
univs : option universes;
subpats : list (pattern * bool)
}
// A pattern-bound *named* variable.
| Pat_Var {
v : namedv;
sort : sealed typ;
}
// Dot pattern: resolved by other elements in the pattern and type
| Pat_Dot_Term {
t : option term;
}
type branch = pattern & term
type match_returns_ascription = binder & (either term comp & option term & bool)
[@@plugin]
noeq
type named_term_view =
| Tv_Var : v:namedv -> named_term_view
| Tv_BVar : v:bv -> named_term_view
| Tv_FVar : v:fv -> named_term_view
| Tv_UInst : v:fv -> us:universes -> named_term_view
| Tv_App : hd:term -> a:argv -> named_term_view
| Tv_Abs : b:binder -> body:term -> named_term_view
| Tv_Arrow : b:binder -> c:comp -> named_term_view
| Tv_Type : universe -> named_term_view
| Tv_Refine : b:simple_binder -> ref:term -> named_term_view
| Tv_Const : vconst -> named_term_view
| Tv_Uvar : nat -> ctx_uvar_and_subst -> named_term_view
| Tv_Let : recf:bool -> attrs:(list term) -> b:simple_binder -> def:term -> body:term -> named_term_view
| Tv_Match : scrutinee:term -> ret:option match_returns_ascription -> brs:(list branch) -> named_term_view
| Tv_AscribedT : e:term -> t:term -> tac:option term -> use_eq:bool -> named_term_view
| Tv_AscribedC : e:term -> c:comp -> tac:option term -> use_eq:bool -> named_term_view
| Tv_Unknown : named_term_view // An underscore: _
| Tv_Unsupp : named_term_view // failed to inspect, not supported | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.NamedView.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 | tv: FStar.Tactics.NamedView.named_term_view -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"FStar.Tactics.NamedView.named_term_view",
"Prims.op_AmpAmp",
"Prims.op_Negation",
"FStar.Tactics.NamedView.uu___is_Tv_AscribedT",
"FStar.Tactics.NamedView.uu___is_Tv_AscribedC",
"Prims.bool"
] | [] | false | false | false | true | false | let notAscription (tv: named_term_view) : bool =
| not (Tv_AscribedT? tv) && not (Tv_AscribedC? tv) | false |
FStar.Tactics.NamedView.fsti | FStar.Tactics.NamedView.is_simple_binder | val is_simple_binder : b: FStar.Tactics.NamedView.binder -> Prims.logical | let is_simple_binder (b:binder) = Q_Explicit? b.qual /\ Nil? b.attrs | {
"file_name": "ulib/FStar.Tactics.NamedView.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 68,
"end_line": 45,
"start_col": 0,
"start_line": 45
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.NamedView
open FStar.Tactics.Effect
open FStar.Reflection.V2
module R = FStar.Reflection.V2
(* Re export the syntax types. Expose variables as their views, users do
not need to pack/inspect these if they are using the named view. *)
type namedv = R.namedv_view
type bv = R.bv_view
type comp = R.comp_view
type binding = R.binding (* already good *)
(* Terms and universes are still *deep*, so we do not change their
representation, and the user needs to pack/inspect. *)
type term = R.term
type universe = R.universe
[@@plugin]
noeq
type binder = {
uniq : nat;
ppname : ppname_t;
sort : R.typ;
qual : aqualv;
attrs : list term;
}
type binders = list binder | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.NamedView.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | b: FStar.Tactics.NamedView.binder -> Prims.logical | Prims.Tot | [
"total"
] | [] | [
"FStar.Tactics.NamedView.binder",
"Prims.l_and",
"Prims.b2t",
"FStar.Stubs.Reflection.V2.Data.uu___is_Q_Explicit",
"FStar.Tactics.NamedView.__proj__Mkbinder__item__qual",
"Prims.uu___is_Nil",
"FStar.Tactics.NamedView.term",
"FStar.Tactics.NamedView.__proj__Mkbinder__item__attrs",
"Prims.logical"
] | [] | false | false | false | true | true | let is_simple_binder (b: binder) =
| Q_Explicit? b.qual /\ Nil? b.attrs | false |
|
FStar.Tactics.NamedView.fsti | FStar.Tactics.NamedView.binding_to_binder | val binding_to_binder (bnd: binding) : binder | val binding_to_binder (bnd: binding) : binder | let binding_to_binder (bnd : binding) : binder =
{
ppname = bnd.ppname;
uniq = bnd.uniq;
sort = bnd.sort;
qual = Q_Explicit;
attrs = []
} | {
"file_name": "ulib/FStar.Tactics.NamedView.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 3,
"end_line": 169,
"start_col": 0,
"start_line": 162
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.NamedView
open FStar.Tactics.Effect
open FStar.Reflection.V2
module R = FStar.Reflection.V2
(* Re export the syntax types. Expose variables as their views, users do
not need to pack/inspect these if they are using the named view. *)
type namedv = R.namedv_view
type bv = R.bv_view
type comp = R.comp_view
type binding = R.binding (* already good *)
(* Terms and universes are still *deep*, so we do not change their
representation, and the user needs to pack/inspect. *)
type term = R.term
type universe = R.universe
[@@plugin]
noeq
type binder = {
uniq : nat;
ppname : ppname_t;
sort : R.typ;
qual : aqualv;
attrs : list term;
}
type binders = list binder
let is_simple_binder (b:binder) = Q_Explicit? b.qual /\ Nil? b.attrs
type simple_binder = b:binder{is_simple_binder b}
type univ_name = string & Range.range
[@@plugin]
noeq
type named_universe_view =
| Uv_Zero : named_universe_view
| Uv_Succ : universe -> named_universe_view
| Uv_Max : universes -> named_universe_view
| Uv_BVar : nat -> named_universe_view
| Uv_Name : univ_name -> named_universe_view
| Uv_Unif : R.universe_uvar -> named_universe_view
| Uv_Unk : named_universe_view
[@@plugin]
noeq
type pattern =
// A built-in constant
| Pat_Constant {
c : vconst
}
// A fully applied constructor, each boolean marks whether the
// argument was an explicitly-provided implicit argument
| Pat_Cons {
head : fv;
univs : option universes;
subpats : list (pattern * bool)
}
// A pattern-bound *named* variable.
| Pat_Var {
v : namedv;
sort : sealed typ;
}
// Dot pattern: resolved by other elements in the pattern and type
| Pat_Dot_Term {
t : option term;
}
type branch = pattern & term
type match_returns_ascription = binder & (either term comp & option term & bool)
[@@plugin]
noeq
type named_term_view =
| Tv_Var : v:namedv -> named_term_view
| Tv_BVar : v:bv -> named_term_view
| Tv_FVar : v:fv -> named_term_view
| Tv_UInst : v:fv -> us:universes -> named_term_view
| Tv_App : hd:term -> a:argv -> named_term_view
| Tv_Abs : b:binder -> body:term -> named_term_view
| Tv_Arrow : b:binder -> c:comp -> named_term_view
| Tv_Type : universe -> named_term_view
| Tv_Refine : b:simple_binder -> ref:term -> named_term_view
| Tv_Const : vconst -> named_term_view
| Tv_Uvar : nat -> ctx_uvar_and_subst -> named_term_view
| Tv_Let : recf:bool -> attrs:(list term) -> b:simple_binder -> def:term -> body:term -> named_term_view
| Tv_Match : scrutinee:term -> ret:option match_returns_ascription -> brs:(list branch) -> named_term_view
| Tv_AscribedT : e:term -> t:term -> tac:option term -> use_eq:bool -> named_term_view
| Tv_AscribedC : e:term -> c:comp -> tac:option term -> use_eq:bool -> named_term_view
| Tv_Unknown : named_term_view // An underscore: _
| Tv_Unsupp : named_term_view // failed to inspect, not supported
// Repeat from FStar.R.Data
let notAscription (tv:named_term_view) : bool =
not (Tv_AscribedT? tv) && not (Tv_AscribedC? tv)
[@@plugin]
noeq
type letbinding = {
lb_fv : fv;
lb_us : list univ_name; (* opened *)
lb_typ : typ;
lb_def : term;
}
[@@plugin]
noeq
type named_sigelt_view =
| Sg_Let {
isrec : bool;
lbs : list letbinding;
}
// Sg_Inductive basically coalesces the Sig_bundle used internally,
// where the type definition and its constructors are split.
// While that might be better for typechecking, this is probably better for metaprogrammers
// (no mutually defined types for now)
| Sg_Inductive {
nm : name; // name of the inductive type being defined
univs : list univ_name; // named universe variables
params : binders; // parameters
typ : typ; // the type annotation for the inductive, i.e., indices -> Type #u
ctors : list ctor; // the constructors, opened with univs and applied to params already
}
| Sg_Val {
nm : name;
univs : list univ_name;
typ : typ;
}
| Unk
(* Some helpers. The latter two are not marked coercions as they make a
choice to not add qualifiers/attrs, so we let the user call them. *)
[@@coercion]
let binder_to_binding (b : binder) : binding =
{
ppname = b.ppname;
uniq = b.uniq;
sort = b.sort; | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.NamedView.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 | bnd: FStar.Tactics.NamedView.binding -> FStar.Tactics.NamedView.binder | Prims.Tot | [
"total"
] | [] | [
"FStar.Tactics.NamedView.binding",
"FStar.Tactics.NamedView.Mkbinder",
"FStar.Stubs.Reflection.V2.Data.__proj__Mkbinding__item__uniq",
"FStar.Stubs.Reflection.V2.Data.__proj__Mkbinding__item__ppname",
"FStar.Stubs.Reflection.V2.Data.__proj__Mkbinding__item__sort",
"FStar.Stubs.Reflection.V2.Data.Q_Explicit",
"Prims.Nil",
"FStar.Tactics.NamedView.term",
"FStar.Tactics.NamedView.binder"
] | [] | false | false | false | true | false | let binding_to_binder (bnd: binding) : binder =
| { ppname = bnd.ppname; uniq = bnd.uniq; sort = bnd.sort; qual = Q_Explicit; attrs = [] } | false |
FStar.Tactics.NamedView.fsti | FStar.Tactics.NamedView.binder_to_binding | val binder_to_binding (b: binder) : binding | val binder_to_binding (b: binder) : binding | let binder_to_binding (b : binder) : binding =
{
ppname = b.ppname;
uniq = b.uniq;
sort = b.sort;
} | {
"file_name": "ulib/FStar.Tactics.NamedView.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 3,
"end_line": 161,
"start_col": 0,
"start_line": 156
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.NamedView
open FStar.Tactics.Effect
open FStar.Reflection.V2
module R = FStar.Reflection.V2
(* Re export the syntax types. Expose variables as their views, users do
not need to pack/inspect these if they are using the named view. *)
type namedv = R.namedv_view
type bv = R.bv_view
type comp = R.comp_view
type binding = R.binding (* already good *)
(* Terms and universes are still *deep*, so we do not change their
representation, and the user needs to pack/inspect. *)
type term = R.term
type universe = R.universe
[@@plugin]
noeq
type binder = {
uniq : nat;
ppname : ppname_t;
sort : R.typ;
qual : aqualv;
attrs : list term;
}
type binders = list binder
let is_simple_binder (b:binder) = Q_Explicit? b.qual /\ Nil? b.attrs
type simple_binder = b:binder{is_simple_binder b}
type univ_name = string & Range.range
[@@plugin]
noeq
type named_universe_view =
| Uv_Zero : named_universe_view
| Uv_Succ : universe -> named_universe_view
| Uv_Max : universes -> named_universe_view
| Uv_BVar : nat -> named_universe_view
| Uv_Name : univ_name -> named_universe_view
| Uv_Unif : R.universe_uvar -> named_universe_view
| Uv_Unk : named_universe_view
[@@plugin]
noeq
type pattern =
// A built-in constant
| Pat_Constant {
c : vconst
}
// A fully applied constructor, each boolean marks whether the
// argument was an explicitly-provided implicit argument
| Pat_Cons {
head : fv;
univs : option universes;
subpats : list (pattern * bool)
}
// A pattern-bound *named* variable.
| Pat_Var {
v : namedv;
sort : sealed typ;
}
// Dot pattern: resolved by other elements in the pattern and type
| Pat_Dot_Term {
t : option term;
}
type branch = pattern & term
type match_returns_ascription = binder & (either term comp & option term & bool)
[@@plugin]
noeq
type named_term_view =
| Tv_Var : v:namedv -> named_term_view
| Tv_BVar : v:bv -> named_term_view
| Tv_FVar : v:fv -> named_term_view
| Tv_UInst : v:fv -> us:universes -> named_term_view
| Tv_App : hd:term -> a:argv -> named_term_view
| Tv_Abs : b:binder -> body:term -> named_term_view
| Tv_Arrow : b:binder -> c:comp -> named_term_view
| Tv_Type : universe -> named_term_view
| Tv_Refine : b:simple_binder -> ref:term -> named_term_view
| Tv_Const : vconst -> named_term_view
| Tv_Uvar : nat -> ctx_uvar_and_subst -> named_term_view
| Tv_Let : recf:bool -> attrs:(list term) -> b:simple_binder -> def:term -> body:term -> named_term_view
| Tv_Match : scrutinee:term -> ret:option match_returns_ascription -> brs:(list branch) -> named_term_view
| Tv_AscribedT : e:term -> t:term -> tac:option term -> use_eq:bool -> named_term_view
| Tv_AscribedC : e:term -> c:comp -> tac:option term -> use_eq:bool -> named_term_view
| Tv_Unknown : named_term_view // An underscore: _
| Tv_Unsupp : named_term_view // failed to inspect, not supported
// Repeat from FStar.R.Data
let notAscription (tv:named_term_view) : bool =
not (Tv_AscribedT? tv) && not (Tv_AscribedC? tv)
[@@plugin]
noeq
type letbinding = {
lb_fv : fv;
lb_us : list univ_name; (* opened *)
lb_typ : typ;
lb_def : term;
}
[@@plugin]
noeq
type named_sigelt_view =
| Sg_Let {
isrec : bool;
lbs : list letbinding;
}
// Sg_Inductive basically coalesces the Sig_bundle used internally,
// where the type definition and its constructors are split.
// While that might be better for typechecking, this is probably better for metaprogrammers
// (no mutually defined types for now)
| Sg_Inductive {
nm : name; // name of the inductive type being defined
univs : list univ_name; // named universe variables
params : binders; // parameters
typ : typ; // the type annotation for the inductive, i.e., indices -> Type #u
ctors : list ctor; // the constructors, opened with univs and applied to params already
}
| Sg_Val {
nm : name;
univs : list univ_name;
typ : typ;
}
| Unk
(* Some helpers. The latter two are not marked coercions as they make a
choice to not add qualifiers/attrs, so we let the user call them. *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.NamedView.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | b: FStar.Tactics.NamedView.binder -> FStar.Tactics.NamedView.binding | Prims.Tot | [
"total"
] | [] | [
"FStar.Tactics.NamedView.binder",
"FStar.Stubs.Reflection.V2.Data.Mkbinding",
"FStar.Tactics.NamedView.__proj__Mkbinder__item__uniq",
"FStar.Tactics.NamedView.__proj__Mkbinder__item__sort",
"FStar.Tactics.NamedView.__proj__Mkbinder__item__ppname",
"FStar.Tactics.NamedView.binding"
] | [] | false | false | false | true | false | let binder_to_binding (b: binder) : binding =
| { ppname = b.ppname; uniq = b.uniq; sort = b.sort } | false |
FStar.Tactics.NamedView.fsti | FStar.Tactics.NamedView.namedv_to_binder | val namedv_to_binder (v: namedv) (sort: term) : binder | val namedv_to_binder (v: namedv) (sort: term) : binder | let namedv_to_binder (v : namedv) (sort : term) : binder =
{
uniq = v.uniq;
sort = sort;
ppname = v.ppname;
qual = Q_Explicit;
attrs = [];
} | {
"file_name": "ulib/FStar.Tactics.NamedView.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 3,
"end_line": 177,
"start_col": 0,
"start_line": 170
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.NamedView
open FStar.Tactics.Effect
open FStar.Reflection.V2
module R = FStar.Reflection.V2
(* Re export the syntax types. Expose variables as their views, users do
not need to pack/inspect these if they are using the named view. *)
type namedv = R.namedv_view
type bv = R.bv_view
type comp = R.comp_view
type binding = R.binding (* already good *)
(* Terms and universes are still *deep*, so we do not change their
representation, and the user needs to pack/inspect. *)
type term = R.term
type universe = R.universe
[@@plugin]
noeq
type binder = {
uniq : nat;
ppname : ppname_t;
sort : R.typ;
qual : aqualv;
attrs : list term;
}
type binders = list binder
let is_simple_binder (b:binder) = Q_Explicit? b.qual /\ Nil? b.attrs
type simple_binder = b:binder{is_simple_binder b}
type univ_name = string & Range.range
[@@plugin]
noeq
type named_universe_view =
| Uv_Zero : named_universe_view
| Uv_Succ : universe -> named_universe_view
| Uv_Max : universes -> named_universe_view
| Uv_BVar : nat -> named_universe_view
| Uv_Name : univ_name -> named_universe_view
| Uv_Unif : R.universe_uvar -> named_universe_view
| Uv_Unk : named_universe_view
[@@plugin]
noeq
type pattern =
// A built-in constant
| Pat_Constant {
c : vconst
}
// A fully applied constructor, each boolean marks whether the
// argument was an explicitly-provided implicit argument
| Pat_Cons {
head : fv;
univs : option universes;
subpats : list (pattern * bool)
}
// A pattern-bound *named* variable.
| Pat_Var {
v : namedv;
sort : sealed typ;
}
// Dot pattern: resolved by other elements in the pattern and type
| Pat_Dot_Term {
t : option term;
}
type branch = pattern & term
type match_returns_ascription = binder & (either term comp & option term & bool)
[@@plugin]
noeq
type named_term_view =
| Tv_Var : v:namedv -> named_term_view
| Tv_BVar : v:bv -> named_term_view
| Tv_FVar : v:fv -> named_term_view
| Tv_UInst : v:fv -> us:universes -> named_term_view
| Tv_App : hd:term -> a:argv -> named_term_view
| Tv_Abs : b:binder -> body:term -> named_term_view
| Tv_Arrow : b:binder -> c:comp -> named_term_view
| Tv_Type : universe -> named_term_view
| Tv_Refine : b:simple_binder -> ref:term -> named_term_view
| Tv_Const : vconst -> named_term_view
| Tv_Uvar : nat -> ctx_uvar_and_subst -> named_term_view
| Tv_Let : recf:bool -> attrs:(list term) -> b:simple_binder -> def:term -> body:term -> named_term_view
| Tv_Match : scrutinee:term -> ret:option match_returns_ascription -> brs:(list branch) -> named_term_view
| Tv_AscribedT : e:term -> t:term -> tac:option term -> use_eq:bool -> named_term_view
| Tv_AscribedC : e:term -> c:comp -> tac:option term -> use_eq:bool -> named_term_view
| Tv_Unknown : named_term_view // An underscore: _
| Tv_Unsupp : named_term_view // failed to inspect, not supported
// Repeat from FStar.R.Data
let notAscription (tv:named_term_view) : bool =
not (Tv_AscribedT? tv) && not (Tv_AscribedC? tv)
[@@plugin]
noeq
type letbinding = {
lb_fv : fv;
lb_us : list univ_name; (* opened *)
lb_typ : typ;
lb_def : term;
}
[@@plugin]
noeq
type named_sigelt_view =
| Sg_Let {
isrec : bool;
lbs : list letbinding;
}
// Sg_Inductive basically coalesces the Sig_bundle used internally,
// where the type definition and its constructors are split.
// While that might be better for typechecking, this is probably better for metaprogrammers
// (no mutually defined types for now)
| Sg_Inductive {
nm : name; // name of the inductive type being defined
univs : list univ_name; // named universe variables
params : binders; // parameters
typ : typ; // the type annotation for the inductive, i.e., indices -> Type #u
ctors : list ctor; // the constructors, opened with univs and applied to params already
}
| Sg_Val {
nm : name;
univs : list univ_name;
typ : typ;
}
| Unk
(* Some helpers. The latter two are not marked coercions as they make a
choice to not add qualifiers/attrs, so we let the user call them. *)
[@@coercion]
let binder_to_binding (b : binder) : binding =
{
ppname = b.ppname;
uniq = b.uniq;
sort = b.sort;
}
let binding_to_binder (bnd : binding) : binder =
{
ppname = bnd.ppname;
uniq = bnd.uniq;
sort = bnd.sort;
qual = Q_Explicit;
attrs = [] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.NamedView.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 | v: FStar.Tactics.NamedView.namedv -> sort: FStar.Tactics.NamedView.term
-> FStar.Tactics.NamedView.binder | Prims.Tot | [
"total"
] | [] | [
"FStar.Tactics.NamedView.namedv",
"FStar.Tactics.NamedView.term",
"FStar.Tactics.NamedView.Mkbinder",
"FStar.Stubs.Reflection.V2.Data.__proj__Mknamedv_view__item__uniq",
"FStar.Stubs.Reflection.V2.Data.__proj__Mknamedv_view__item__ppname",
"FStar.Stubs.Reflection.V2.Data.Q_Explicit",
"Prims.Nil",
"FStar.Tactics.NamedView.binder"
] | [] | false | false | false | true | false | let namedv_to_binder (v: namedv) (sort: term) : binder =
| { uniq = v.uniq; sort = sort; ppname = v.ppname; qual = Q_Explicit; attrs = [] } | false |
FStar.Tactics.NamedView.fsti | FStar.Tactics.NamedView.universe_view | val universe_view : Type0 | let universe_view = named_universe_view | {
"file_name": "ulib/FStar.Tactics.NamedView.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 39,
"end_line": 207,
"start_col": 0,
"start_line": 207
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.NamedView
open FStar.Tactics.Effect
open FStar.Reflection.V2
module R = FStar.Reflection.V2
(* Re export the syntax types. Expose variables as their views, users do
not need to pack/inspect these if they are using the named view. *)
type namedv = R.namedv_view
type bv = R.bv_view
type comp = R.comp_view
type binding = R.binding (* already good *)
(* Terms and universes are still *deep*, so we do not change their
representation, and the user needs to pack/inspect. *)
type term = R.term
type universe = R.universe
[@@plugin]
noeq
type binder = {
uniq : nat;
ppname : ppname_t;
sort : R.typ;
qual : aqualv;
attrs : list term;
}
type binders = list binder
let is_simple_binder (b:binder) = Q_Explicit? b.qual /\ Nil? b.attrs
type simple_binder = b:binder{is_simple_binder b}
type univ_name = string & Range.range
[@@plugin]
noeq
type named_universe_view =
| Uv_Zero : named_universe_view
| Uv_Succ : universe -> named_universe_view
| Uv_Max : universes -> named_universe_view
| Uv_BVar : nat -> named_universe_view
| Uv_Name : univ_name -> named_universe_view
| Uv_Unif : R.universe_uvar -> named_universe_view
| Uv_Unk : named_universe_view
[@@plugin]
noeq
type pattern =
// A built-in constant
| Pat_Constant {
c : vconst
}
// A fully applied constructor, each boolean marks whether the
// argument was an explicitly-provided implicit argument
| Pat_Cons {
head : fv;
univs : option universes;
subpats : list (pattern * bool)
}
// A pattern-bound *named* variable.
| Pat_Var {
v : namedv;
sort : sealed typ;
}
// Dot pattern: resolved by other elements in the pattern and type
| Pat_Dot_Term {
t : option term;
}
type branch = pattern & term
type match_returns_ascription = binder & (either term comp & option term & bool)
[@@plugin]
noeq
type named_term_view =
| Tv_Var : v:namedv -> named_term_view
| Tv_BVar : v:bv -> named_term_view
| Tv_FVar : v:fv -> named_term_view
| Tv_UInst : v:fv -> us:universes -> named_term_view
| Tv_App : hd:term -> a:argv -> named_term_view
| Tv_Abs : b:binder -> body:term -> named_term_view
| Tv_Arrow : b:binder -> c:comp -> named_term_view
| Tv_Type : universe -> named_term_view
| Tv_Refine : b:simple_binder -> ref:term -> named_term_view
| Tv_Const : vconst -> named_term_view
| Tv_Uvar : nat -> ctx_uvar_and_subst -> named_term_view
| Tv_Let : recf:bool -> attrs:(list term) -> b:simple_binder -> def:term -> body:term -> named_term_view
| Tv_Match : scrutinee:term -> ret:option match_returns_ascription -> brs:(list branch) -> named_term_view
| Tv_AscribedT : e:term -> t:term -> tac:option term -> use_eq:bool -> named_term_view
| Tv_AscribedC : e:term -> c:comp -> tac:option term -> use_eq:bool -> named_term_view
| Tv_Unknown : named_term_view // An underscore: _
| Tv_Unsupp : named_term_view // failed to inspect, not supported
// Repeat from FStar.R.Data
let notAscription (tv:named_term_view) : bool =
not (Tv_AscribedT? tv) && not (Tv_AscribedC? tv)
[@@plugin]
noeq
type letbinding = {
lb_fv : fv;
lb_us : list univ_name; (* opened *)
lb_typ : typ;
lb_def : term;
}
[@@plugin]
noeq
type named_sigelt_view =
| Sg_Let {
isrec : bool;
lbs : list letbinding;
}
// Sg_Inductive basically coalesces the Sig_bundle used internally,
// where the type definition and its constructors are split.
// While that might be better for typechecking, this is probably better for metaprogrammers
// (no mutually defined types for now)
| Sg_Inductive {
nm : name; // name of the inductive type being defined
univs : list univ_name; // named universe variables
params : binders; // parameters
typ : typ; // the type annotation for the inductive, i.e., indices -> Type #u
ctors : list ctor; // the constructors, opened with univs and applied to params already
}
| Sg_Val {
nm : name;
univs : list univ_name;
typ : typ;
}
| Unk
(* Some helpers. The latter two are not marked coercions as they make a
choice to not add qualifiers/attrs, so we let the user call them. *)
[@@coercion]
let binder_to_binding (b : binder) : binding =
{
ppname = b.ppname;
uniq = b.uniq;
sort = b.sort;
}
let binding_to_binder (bnd : binding) : binder =
{
ppname = bnd.ppname;
uniq = bnd.uniq;
sort = bnd.sort;
qual = Q_Explicit;
attrs = []
}
let namedv_to_binder (v : namedv) (sort : term) : binder =
{
uniq = v.uniq;
sort = sort;
ppname = v.ppname;
qual = Q_Explicit;
attrs = [];
}
[@@plugin; coercion]
val inspect_universe (u:universe) : Tot named_universe_view
[@@plugin; coercion]
val pack_universe (uv:named_universe_view) : Tot universe
[@@plugin]
val close_term (b:binder) (t:term) : Tot (R.binder & term)
[@@plugin; coercion]
val inspect (t:term) : Tac named_term_view
[@@plugin; coercion]
val pack (tv:named_term_view) : Tot term
[@@plugin; coercion]
val inspect_sigelt (s : sigelt) : Tac named_sigelt_view
[@@plugin; coercion]
val pack_sigelt (sv:named_sigelt_view{~(Unk? sv)}) : Tac sigelt
(* Some primitives mention `R.comp`, wrap them to use `ThisModule.comp = R.comp_view` *)
[@@plugin]
val tcc (e:env) (t:term) : Tac comp
[@@plugin]
val comp_to_string (c:comp) : Tac string | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.NamedView.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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"
] | [] | [
"FStar.Tactics.NamedView.named_universe_view"
] | [] | false | false | false | true | true | let universe_view =
| named_universe_view | false |
|
Vale.Stdcalls.X64.Aes.fsti | Vale.Stdcalls.X64.Aes.dom | val dom:IX64.arity_ok_stdcall td | val dom:IX64.arity_ok_stdcall td | let dom: IX64.arity_ok_stdcall td =
let y = [t128_no_mod; t128_mod] in
assert_norm (List.length y = 2);
y | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.Aes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 3,
"end_line": 46,
"start_col": 0,
"start_line": 43
} | module Vale.Stdcalls.X64.Aes
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
open Vale.AES.AES_s
module AE = Vale.AES.X64.AES
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret}) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.Aes.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.AES",
"short_module": "AE"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Vale.Interop.X64.arity_ok_stdcall Vale.Interop.Base.td | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"FStar.List.Tot.Base.length",
"Vale.Interop.Base.td",
"Prims.list",
"Prims.Cons",
"Vale.Stdcalls.X64.Aes.t128_no_mod",
"Vale.Stdcalls.X64.Aes.t128_mod",
"Prims.Nil"
] | [] | false | false | false | true | false | let dom:IX64.arity_ok_stdcall td =
| let y = [t128_no_mod; t128_mod] in
assert_norm (List.length y = 2);
y | false |
Vale.Stdcalls.X64.Aes.fsti | Vale.Stdcalls.X64.Aes.as_t | val as_t (#a: Type) (x: normal a) : a | val as_t (#a: Type) (x: normal a) : a | let as_t (#a:Type) (x:normal a) : a = x | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.Aes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 39,
"end_line": 31,
"start_col": 0,
"start_line": 31
} | module Vale.Stdcalls.X64.Aes
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
open Vale.AES.AES_s
module AE = Vale.AES.X64.AES
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.Aes.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.AES",
"short_module": "AE"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x: Vale.Interop.Base.normal a -> a | Prims.Tot | [
"total"
] | [] | [
"Vale.Interop.Base.normal"
] | [] | false | false | false | true | false | let as_t (#a: Type) (x: normal a) : a =
| x | false |
FStar.Tactics.NamedView.fsti | FStar.Tactics.NamedView.term_view | val term_view : Type0 | let term_view = named_term_view | {
"file_name": "ulib/FStar.Tactics.NamedView.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 35,
"end_line": 208,
"start_col": 0,
"start_line": 208
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.NamedView
open FStar.Tactics.Effect
open FStar.Reflection.V2
module R = FStar.Reflection.V2
(* Re export the syntax types. Expose variables as their views, users do
not need to pack/inspect these if they are using the named view. *)
type namedv = R.namedv_view
type bv = R.bv_view
type comp = R.comp_view
type binding = R.binding (* already good *)
(* Terms and universes are still *deep*, so we do not change their
representation, and the user needs to pack/inspect. *)
type term = R.term
type universe = R.universe
[@@plugin]
noeq
type binder = {
uniq : nat;
ppname : ppname_t;
sort : R.typ;
qual : aqualv;
attrs : list term;
}
type binders = list binder
let is_simple_binder (b:binder) = Q_Explicit? b.qual /\ Nil? b.attrs
type simple_binder = b:binder{is_simple_binder b}
type univ_name = string & Range.range
[@@plugin]
noeq
type named_universe_view =
| Uv_Zero : named_universe_view
| Uv_Succ : universe -> named_universe_view
| Uv_Max : universes -> named_universe_view
| Uv_BVar : nat -> named_universe_view
| Uv_Name : univ_name -> named_universe_view
| Uv_Unif : R.universe_uvar -> named_universe_view
| Uv_Unk : named_universe_view
[@@plugin]
noeq
type pattern =
// A built-in constant
| Pat_Constant {
c : vconst
}
// A fully applied constructor, each boolean marks whether the
// argument was an explicitly-provided implicit argument
| Pat_Cons {
head : fv;
univs : option universes;
subpats : list (pattern * bool)
}
// A pattern-bound *named* variable.
| Pat_Var {
v : namedv;
sort : sealed typ;
}
// Dot pattern: resolved by other elements in the pattern and type
| Pat_Dot_Term {
t : option term;
}
type branch = pattern & term
type match_returns_ascription = binder & (either term comp & option term & bool)
[@@plugin]
noeq
type named_term_view =
| Tv_Var : v:namedv -> named_term_view
| Tv_BVar : v:bv -> named_term_view
| Tv_FVar : v:fv -> named_term_view
| Tv_UInst : v:fv -> us:universes -> named_term_view
| Tv_App : hd:term -> a:argv -> named_term_view
| Tv_Abs : b:binder -> body:term -> named_term_view
| Tv_Arrow : b:binder -> c:comp -> named_term_view
| Tv_Type : universe -> named_term_view
| Tv_Refine : b:simple_binder -> ref:term -> named_term_view
| Tv_Const : vconst -> named_term_view
| Tv_Uvar : nat -> ctx_uvar_and_subst -> named_term_view
| Tv_Let : recf:bool -> attrs:(list term) -> b:simple_binder -> def:term -> body:term -> named_term_view
| Tv_Match : scrutinee:term -> ret:option match_returns_ascription -> brs:(list branch) -> named_term_view
| Tv_AscribedT : e:term -> t:term -> tac:option term -> use_eq:bool -> named_term_view
| Tv_AscribedC : e:term -> c:comp -> tac:option term -> use_eq:bool -> named_term_view
| Tv_Unknown : named_term_view // An underscore: _
| Tv_Unsupp : named_term_view // failed to inspect, not supported
// Repeat from FStar.R.Data
let notAscription (tv:named_term_view) : bool =
not (Tv_AscribedT? tv) && not (Tv_AscribedC? tv)
[@@plugin]
noeq
type letbinding = {
lb_fv : fv;
lb_us : list univ_name; (* opened *)
lb_typ : typ;
lb_def : term;
}
[@@plugin]
noeq
type named_sigelt_view =
| Sg_Let {
isrec : bool;
lbs : list letbinding;
}
// Sg_Inductive basically coalesces the Sig_bundle used internally,
// where the type definition and its constructors are split.
// While that might be better for typechecking, this is probably better for metaprogrammers
// (no mutually defined types for now)
| Sg_Inductive {
nm : name; // name of the inductive type being defined
univs : list univ_name; // named universe variables
params : binders; // parameters
typ : typ; // the type annotation for the inductive, i.e., indices -> Type #u
ctors : list ctor; // the constructors, opened with univs and applied to params already
}
| Sg_Val {
nm : name;
univs : list univ_name;
typ : typ;
}
| Unk
(* Some helpers. The latter two are not marked coercions as they make a
choice to not add qualifiers/attrs, so we let the user call them. *)
[@@coercion]
let binder_to_binding (b : binder) : binding =
{
ppname = b.ppname;
uniq = b.uniq;
sort = b.sort;
}
let binding_to_binder (bnd : binding) : binder =
{
ppname = bnd.ppname;
uniq = bnd.uniq;
sort = bnd.sort;
qual = Q_Explicit;
attrs = []
}
let namedv_to_binder (v : namedv) (sort : term) : binder =
{
uniq = v.uniq;
sort = sort;
ppname = v.ppname;
qual = Q_Explicit;
attrs = [];
}
[@@plugin; coercion]
val inspect_universe (u:universe) : Tot named_universe_view
[@@plugin; coercion]
val pack_universe (uv:named_universe_view) : Tot universe
[@@plugin]
val close_term (b:binder) (t:term) : Tot (R.binder & term)
[@@plugin; coercion]
val inspect (t:term) : Tac named_term_view
[@@plugin; coercion]
val pack (tv:named_term_view) : Tot term
[@@plugin; coercion]
val inspect_sigelt (s : sigelt) : Tac named_sigelt_view
[@@plugin; coercion]
val pack_sigelt (sv:named_sigelt_view{~(Unk? sv)}) : Tac sigelt
(* Some primitives mention `R.comp`, wrap them to use `ThisModule.comp = R.comp_view` *)
[@@plugin]
val tcc (e:env) (t:term) : Tac comp
[@@plugin]
val comp_to_string (c:comp) : Tac string
(* Clients of this module use the named view. *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.NamedView.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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"
] | [] | [
"FStar.Tactics.NamedView.named_term_view"
] | [] | false | false | false | true | true | let term_view =
| named_term_view | false |
|
FStar.Tactics.NamedView.fsti | FStar.Tactics.NamedView.sigelt_view | val sigelt_view : Type0 | let sigelt_view = named_sigelt_view | {
"file_name": "ulib/FStar.Tactics.NamedView.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 37,
"end_line": 209,
"start_col": 0,
"start_line": 209
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.NamedView
open FStar.Tactics.Effect
open FStar.Reflection.V2
module R = FStar.Reflection.V2
(* Re export the syntax types. Expose variables as their views, users do
not need to pack/inspect these if they are using the named view. *)
type namedv = R.namedv_view
type bv = R.bv_view
type comp = R.comp_view
type binding = R.binding (* already good *)
(* Terms and universes are still *deep*, so we do not change their
representation, and the user needs to pack/inspect. *)
type term = R.term
type universe = R.universe
[@@plugin]
noeq
type binder = {
uniq : nat;
ppname : ppname_t;
sort : R.typ;
qual : aqualv;
attrs : list term;
}
type binders = list binder
let is_simple_binder (b:binder) = Q_Explicit? b.qual /\ Nil? b.attrs
type simple_binder = b:binder{is_simple_binder b}
type univ_name = string & Range.range
[@@plugin]
noeq
type named_universe_view =
| Uv_Zero : named_universe_view
| Uv_Succ : universe -> named_universe_view
| Uv_Max : universes -> named_universe_view
| Uv_BVar : nat -> named_universe_view
| Uv_Name : univ_name -> named_universe_view
| Uv_Unif : R.universe_uvar -> named_universe_view
| Uv_Unk : named_universe_view
[@@plugin]
noeq
type pattern =
// A built-in constant
| Pat_Constant {
c : vconst
}
// A fully applied constructor, each boolean marks whether the
// argument was an explicitly-provided implicit argument
| Pat_Cons {
head : fv;
univs : option universes;
subpats : list (pattern * bool)
}
// A pattern-bound *named* variable.
| Pat_Var {
v : namedv;
sort : sealed typ;
}
// Dot pattern: resolved by other elements in the pattern and type
| Pat_Dot_Term {
t : option term;
}
type branch = pattern & term
type match_returns_ascription = binder & (either term comp & option term & bool)
[@@plugin]
noeq
type named_term_view =
| Tv_Var : v:namedv -> named_term_view
| Tv_BVar : v:bv -> named_term_view
| Tv_FVar : v:fv -> named_term_view
| Tv_UInst : v:fv -> us:universes -> named_term_view
| Tv_App : hd:term -> a:argv -> named_term_view
| Tv_Abs : b:binder -> body:term -> named_term_view
| Tv_Arrow : b:binder -> c:comp -> named_term_view
| Tv_Type : universe -> named_term_view
| Tv_Refine : b:simple_binder -> ref:term -> named_term_view
| Tv_Const : vconst -> named_term_view
| Tv_Uvar : nat -> ctx_uvar_and_subst -> named_term_view
| Tv_Let : recf:bool -> attrs:(list term) -> b:simple_binder -> def:term -> body:term -> named_term_view
| Tv_Match : scrutinee:term -> ret:option match_returns_ascription -> brs:(list branch) -> named_term_view
| Tv_AscribedT : e:term -> t:term -> tac:option term -> use_eq:bool -> named_term_view
| Tv_AscribedC : e:term -> c:comp -> tac:option term -> use_eq:bool -> named_term_view
| Tv_Unknown : named_term_view // An underscore: _
| Tv_Unsupp : named_term_view // failed to inspect, not supported
// Repeat from FStar.R.Data
let notAscription (tv:named_term_view) : bool =
not (Tv_AscribedT? tv) && not (Tv_AscribedC? tv)
[@@plugin]
noeq
type letbinding = {
lb_fv : fv;
lb_us : list univ_name; (* opened *)
lb_typ : typ;
lb_def : term;
}
[@@plugin]
noeq
type named_sigelt_view =
| Sg_Let {
isrec : bool;
lbs : list letbinding;
}
// Sg_Inductive basically coalesces the Sig_bundle used internally,
// where the type definition and its constructors are split.
// While that might be better for typechecking, this is probably better for metaprogrammers
// (no mutually defined types for now)
| Sg_Inductive {
nm : name; // name of the inductive type being defined
univs : list univ_name; // named universe variables
params : binders; // parameters
typ : typ; // the type annotation for the inductive, i.e., indices -> Type #u
ctors : list ctor; // the constructors, opened with univs and applied to params already
}
| Sg_Val {
nm : name;
univs : list univ_name;
typ : typ;
}
| Unk
(* Some helpers. The latter two are not marked coercions as they make a
choice to not add qualifiers/attrs, so we let the user call them. *)
[@@coercion]
let binder_to_binding (b : binder) : binding =
{
ppname = b.ppname;
uniq = b.uniq;
sort = b.sort;
}
let binding_to_binder (bnd : binding) : binder =
{
ppname = bnd.ppname;
uniq = bnd.uniq;
sort = bnd.sort;
qual = Q_Explicit;
attrs = []
}
let namedv_to_binder (v : namedv) (sort : term) : binder =
{
uniq = v.uniq;
sort = sort;
ppname = v.ppname;
qual = Q_Explicit;
attrs = [];
}
[@@plugin; coercion]
val inspect_universe (u:universe) : Tot named_universe_view
[@@plugin; coercion]
val pack_universe (uv:named_universe_view) : Tot universe
[@@plugin]
val close_term (b:binder) (t:term) : Tot (R.binder & term)
[@@plugin; coercion]
val inspect (t:term) : Tac named_term_view
[@@plugin; coercion]
val pack (tv:named_term_view) : Tot term
[@@plugin; coercion]
val inspect_sigelt (s : sigelt) : Tac named_sigelt_view
[@@plugin; coercion]
val pack_sigelt (sv:named_sigelt_view{~(Unk? sv)}) : Tac sigelt
(* Some primitives mention `R.comp`, wrap them to use `ThisModule.comp = R.comp_view` *)
[@@plugin]
val tcc (e:env) (t:term) : Tac comp
[@@plugin]
val comp_to_string (c:comp) : Tac string
(* Clients of this module use the named view. *)
let universe_view = named_universe_view | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.NamedView.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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"
] | [] | [
"FStar.Tactics.NamedView.named_sigelt_view"
] | [] | false | false | false | true | true | let sigelt_view =
| named_sigelt_view | false |
|
FStar.Tactics.NamedView.fsti | FStar.Tactics.NamedView.inspect_namedv | val inspect_namedv : x: FStar.Tactics.NamedView.namedv -> FStar.Tactics.NamedView.namedv | let inspect_namedv = id #namedv | {
"file_name": "ulib/FStar.Tactics.NamedView.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 33,
"end_line": 212,
"start_col": 0,
"start_line": 212
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.NamedView
open FStar.Tactics.Effect
open FStar.Reflection.V2
module R = FStar.Reflection.V2
(* Re export the syntax types. Expose variables as their views, users do
not need to pack/inspect these if they are using the named view. *)
type namedv = R.namedv_view
type bv = R.bv_view
type comp = R.comp_view
type binding = R.binding (* already good *)
(* Terms and universes are still *deep*, so we do not change their
representation, and the user needs to pack/inspect. *)
type term = R.term
type universe = R.universe
[@@plugin]
noeq
type binder = {
uniq : nat;
ppname : ppname_t;
sort : R.typ;
qual : aqualv;
attrs : list term;
}
type binders = list binder
let is_simple_binder (b:binder) = Q_Explicit? b.qual /\ Nil? b.attrs
type simple_binder = b:binder{is_simple_binder b}
type univ_name = string & Range.range
[@@plugin]
noeq
type named_universe_view =
| Uv_Zero : named_universe_view
| Uv_Succ : universe -> named_universe_view
| Uv_Max : universes -> named_universe_view
| Uv_BVar : nat -> named_universe_view
| Uv_Name : univ_name -> named_universe_view
| Uv_Unif : R.universe_uvar -> named_universe_view
| Uv_Unk : named_universe_view
[@@plugin]
noeq
type pattern =
// A built-in constant
| Pat_Constant {
c : vconst
}
// A fully applied constructor, each boolean marks whether the
// argument was an explicitly-provided implicit argument
| Pat_Cons {
head : fv;
univs : option universes;
subpats : list (pattern * bool)
}
// A pattern-bound *named* variable.
| Pat_Var {
v : namedv;
sort : sealed typ;
}
// Dot pattern: resolved by other elements in the pattern and type
| Pat_Dot_Term {
t : option term;
}
type branch = pattern & term
type match_returns_ascription = binder & (either term comp & option term & bool)
[@@plugin]
noeq
type named_term_view =
| Tv_Var : v:namedv -> named_term_view
| Tv_BVar : v:bv -> named_term_view
| Tv_FVar : v:fv -> named_term_view
| Tv_UInst : v:fv -> us:universes -> named_term_view
| Tv_App : hd:term -> a:argv -> named_term_view
| Tv_Abs : b:binder -> body:term -> named_term_view
| Tv_Arrow : b:binder -> c:comp -> named_term_view
| Tv_Type : universe -> named_term_view
| Tv_Refine : b:simple_binder -> ref:term -> named_term_view
| Tv_Const : vconst -> named_term_view
| Tv_Uvar : nat -> ctx_uvar_and_subst -> named_term_view
| Tv_Let : recf:bool -> attrs:(list term) -> b:simple_binder -> def:term -> body:term -> named_term_view
| Tv_Match : scrutinee:term -> ret:option match_returns_ascription -> brs:(list branch) -> named_term_view
| Tv_AscribedT : e:term -> t:term -> tac:option term -> use_eq:bool -> named_term_view
| Tv_AscribedC : e:term -> c:comp -> tac:option term -> use_eq:bool -> named_term_view
| Tv_Unknown : named_term_view // An underscore: _
| Tv_Unsupp : named_term_view // failed to inspect, not supported
// Repeat from FStar.R.Data
let notAscription (tv:named_term_view) : bool =
not (Tv_AscribedT? tv) && not (Tv_AscribedC? tv)
[@@plugin]
noeq
type letbinding = {
lb_fv : fv;
lb_us : list univ_name; (* opened *)
lb_typ : typ;
lb_def : term;
}
[@@plugin]
noeq
type named_sigelt_view =
| Sg_Let {
isrec : bool;
lbs : list letbinding;
}
// Sg_Inductive basically coalesces the Sig_bundle used internally,
// where the type definition and its constructors are split.
// While that might be better for typechecking, this is probably better for metaprogrammers
// (no mutually defined types for now)
| Sg_Inductive {
nm : name; // name of the inductive type being defined
univs : list univ_name; // named universe variables
params : binders; // parameters
typ : typ; // the type annotation for the inductive, i.e., indices -> Type #u
ctors : list ctor; // the constructors, opened with univs and applied to params already
}
| Sg_Val {
nm : name;
univs : list univ_name;
typ : typ;
}
| Unk
(* Some helpers. The latter two are not marked coercions as they make a
choice to not add qualifiers/attrs, so we let the user call them. *)
[@@coercion]
let binder_to_binding (b : binder) : binding =
{
ppname = b.ppname;
uniq = b.uniq;
sort = b.sort;
}
let binding_to_binder (bnd : binding) : binder =
{
ppname = bnd.ppname;
uniq = bnd.uniq;
sort = bnd.sort;
qual = Q_Explicit;
attrs = []
}
let namedv_to_binder (v : namedv) (sort : term) : binder =
{
uniq = v.uniq;
sort = sort;
ppname = v.ppname;
qual = Q_Explicit;
attrs = [];
}
[@@plugin; coercion]
val inspect_universe (u:universe) : Tot named_universe_view
[@@plugin; coercion]
val pack_universe (uv:named_universe_view) : Tot universe
[@@plugin]
val close_term (b:binder) (t:term) : Tot (R.binder & term)
[@@plugin; coercion]
val inspect (t:term) : Tac named_term_view
[@@plugin; coercion]
val pack (tv:named_term_view) : Tot term
[@@plugin; coercion]
val inspect_sigelt (s : sigelt) : Tac named_sigelt_view
[@@plugin; coercion]
val pack_sigelt (sv:named_sigelt_view{~(Unk? sv)}) : Tac sigelt
(* Some primitives mention `R.comp`, wrap them to use `ThisModule.comp = R.comp_view` *)
[@@plugin]
val tcc (e:env) (t:term) : Tac comp
[@@plugin]
val comp_to_string (c:comp) : Tac string
(* Clients of this module use the named view. *)
let universe_view = named_universe_view
let term_view = named_term_view
let sigelt_view = named_sigelt_view | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.NamedView.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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.Tactics.NamedView.namedv -> FStar.Tactics.NamedView.namedv | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.id",
"FStar.Tactics.NamedView.namedv"
] | [] | false | false | false | true | false | let inspect_namedv =
| id #namedv | false |
|
FStar.Tactics.NamedView.fsti | FStar.Tactics.NamedView.pack_namedv | val pack_namedv : x: FStar.Tactics.NamedView.namedv -> FStar.Tactics.NamedView.namedv | let pack_namedv = id #namedv | {
"file_name": "ulib/FStar.Tactics.NamedView.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 33,
"end_line": 213,
"start_col": 0,
"start_line": 213
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.NamedView
open FStar.Tactics.Effect
open FStar.Reflection.V2
module R = FStar.Reflection.V2
(* Re export the syntax types. Expose variables as their views, users do
not need to pack/inspect these if they are using the named view. *)
type namedv = R.namedv_view
type bv = R.bv_view
type comp = R.comp_view
type binding = R.binding (* already good *)
(* Terms and universes are still *deep*, so we do not change their
representation, and the user needs to pack/inspect. *)
type term = R.term
type universe = R.universe
[@@plugin]
noeq
type binder = {
uniq : nat;
ppname : ppname_t;
sort : R.typ;
qual : aqualv;
attrs : list term;
}
type binders = list binder
let is_simple_binder (b:binder) = Q_Explicit? b.qual /\ Nil? b.attrs
type simple_binder = b:binder{is_simple_binder b}
type univ_name = string & Range.range
[@@plugin]
noeq
type named_universe_view =
| Uv_Zero : named_universe_view
| Uv_Succ : universe -> named_universe_view
| Uv_Max : universes -> named_universe_view
| Uv_BVar : nat -> named_universe_view
| Uv_Name : univ_name -> named_universe_view
| Uv_Unif : R.universe_uvar -> named_universe_view
| Uv_Unk : named_universe_view
[@@plugin]
noeq
type pattern =
// A built-in constant
| Pat_Constant {
c : vconst
}
// A fully applied constructor, each boolean marks whether the
// argument was an explicitly-provided implicit argument
| Pat_Cons {
head : fv;
univs : option universes;
subpats : list (pattern * bool)
}
// A pattern-bound *named* variable.
| Pat_Var {
v : namedv;
sort : sealed typ;
}
// Dot pattern: resolved by other elements in the pattern and type
| Pat_Dot_Term {
t : option term;
}
type branch = pattern & term
type match_returns_ascription = binder & (either term comp & option term & bool)
[@@plugin]
noeq
type named_term_view =
| Tv_Var : v:namedv -> named_term_view
| Tv_BVar : v:bv -> named_term_view
| Tv_FVar : v:fv -> named_term_view
| Tv_UInst : v:fv -> us:universes -> named_term_view
| Tv_App : hd:term -> a:argv -> named_term_view
| Tv_Abs : b:binder -> body:term -> named_term_view
| Tv_Arrow : b:binder -> c:comp -> named_term_view
| Tv_Type : universe -> named_term_view
| Tv_Refine : b:simple_binder -> ref:term -> named_term_view
| Tv_Const : vconst -> named_term_view
| Tv_Uvar : nat -> ctx_uvar_and_subst -> named_term_view
| Tv_Let : recf:bool -> attrs:(list term) -> b:simple_binder -> def:term -> body:term -> named_term_view
| Tv_Match : scrutinee:term -> ret:option match_returns_ascription -> brs:(list branch) -> named_term_view
| Tv_AscribedT : e:term -> t:term -> tac:option term -> use_eq:bool -> named_term_view
| Tv_AscribedC : e:term -> c:comp -> tac:option term -> use_eq:bool -> named_term_view
| Tv_Unknown : named_term_view // An underscore: _
| Tv_Unsupp : named_term_view // failed to inspect, not supported
// Repeat from FStar.R.Data
let notAscription (tv:named_term_view) : bool =
not (Tv_AscribedT? tv) && not (Tv_AscribedC? tv)
[@@plugin]
noeq
type letbinding = {
lb_fv : fv;
lb_us : list univ_name; (* opened *)
lb_typ : typ;
lb_def : term;
}
[@@plugin]
noeq
type named_sigelt_view =
| Sg_Let {
isrec : bool;
lbs : list letbinding;
}
// Sg_Inductive basically coalesces the Sig_bundle used internally,
// where the type definition and its constructors are split.
// While that might be better for typechecking, this is probably better for metaprogrammers
// (no mutually defined types for now)
| Sg_Inductive {
nm : name; // name of the inductive type being defined
univs : list univ_name; // named universe variables
params : binders; // parameters
typ : typ; // the type annotation for the inductive, i.e., indices -> Type #u
ctors : list ctor; // the constructors, opened with univs and applied to params already
}
| Sg_Val {
nm : name;
univs : list univ_name;
typ : typ;
}
| Unk
(* Some helpers. The latter two are not marked coercions as they make a
choice to not add qualifiers/attrs, so we let the user call them. *)
[@@coercion]
let binder_to_binding (b : binder) : binding =
{
ppname = b.ppname;
uniq = b.uniq;
sort = b.sort;
}
let binding_to_binder (bnd : binding) : binder =
{
ppname = bnd.ppname;
uniq = bnd.uniq;
sort = bnd.sort;
qual = Q_Explicit;
attrs = []
}
let namedv_to_binder (v : namedv) (sort : term) : binder =
{
uniq = v.uniq;
sort = sort;
ppname = v.ppname;
qual = Q_Explicit;
attrs = [];
}
[@@plugin; coercion]
val inspect_universe (u:universe) : Tot named_universe_view
[@@plugin; coercion]
val pack_universe (uv:named_universe_view) : Tot universe
[@@plugin]
val close_term (b:binder) (t:term) : Tot (R.binder & term)
[@@plugin; coercion]
val inspect (t:term) : Tac named_term_view
[@@plugin; coercion]
val pack (tv:named_term_view) : Tot term
[@@plugin; coercion]
val inspect_sigelt (s : sigelt) : Tac named_sigelt_view
[@@plugin; coercion]
val pack_sigelt (sv:named_sigelt_view{~(Unk? sv)}) : Tac sigelt
(* Some primitives mention `R.comp`, wrap them to use `ThisModule.comp = R.comp_view` *)
[@@plugin]
val tcc (e:env) (t:term) : Tac comp
[@@plugin]
val comp_to_string (c:comp) : Tac string
(* Clients of this module use the named view. *)
let universe_view = named_universe_view
let term_view = named_term_view
let sigelt_view = named_sigelt_view
(* Temporary adapters, to avoid breaking existing code too much. *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.NamedView.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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.Tactics.NamedView.namedv -> FStar.Tactics.NamedView.namedv | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.id",
"FStar.Tactics.NamedView.namedv"
] | [] | false | false | false | true | false | let pack_namedv =
| id #namedv | false |
|
FStar.Tactics.NamedView.fsti | FStar.Tactics.NamedView.inspect_bv | val inspect_bv : x: FStar.Tactics.NamedView.bv -> FStar.Tactics.NamedView.bv | let inspect_bv = id #bv | {
"file_name": "ulib/FStar.Tactics.NamedView.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 29,
"end_line": 214,
"start_col": 0,
"start_line": 214
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.NamedView
open FStar.Tactics.Effect
open FStar.Reflection.V2
module R = FStar.Reflection.V2
(* Re export the syntax types. Expose variables as their views, users do
not need to pack/inspect these if they are using the named view. *)
type namedv = R.namedv_view
type bv = R.bv_view
type comp = R.comp_view
type binding = R.binding (* already good *)
(* Terms and universes are still *deep*, so we do not change their
representation, and the user needs to pack/inspect. *)
type term = R.term
type universe = R.universe
[@@plugin]
noeq
type binder = {
uniq : nat;
ppname : ppname_t;
sort : R.typ;
qual : aqualv;
attrs : list term;
}
type binders = list binder
let is_simple_binder (b:binder) = Q_Explicit? b.qual /\ Nil? b.attrs
type simple_binder = b:binder{is_simple_binder b}
type univ_name = string & Range.range
[@@plugin]
noeq
type named_universe_view =
| Uv_Zero : named_universe_view
| Uv_Succ : universe -> named_universe_view
| Uv_Max : universes -> named_universe_view
| Uv_BVar : nat -> named_universe_view
| Uv_Name : univ_name -> named_universe_view
| Uv_Unif : R.universe_uvar -> named_universe_view
| Uv_Unk : named_universe_view
[@@plugin]
noeq
type pattern =
// A built-in constant
| Pat_Constant {
c : vconst
}
// A fully applied constructor, each boolean marks whether the
// argument was an explicitly-provided implicit argument
| Pat_Cons {
head : fv;
univs : option universes;
subpats : list (pattern * bool)
}
// A pattern-bound *named* variable.
| Pat_Var {
v : namedv;
sort : sealed typ;
}
// Dot pattern: resolved by other elements in the pattern and type
| Pat_Dot_Term {
t : option term;
}
type branch = pattern & term
type match_returns_ascription = binder & (either term comp & option term & bool)
[@@plugin]
noeq
type named_term_view =
| Tv_Var : v:namedv -> named_term_view
| Tv_BVar : v:bv -> named_term_view
| Tv_FVar : v:fv -> named_term_view
| Tv_UInst : v:fv -> us:universes -> named_term_view
| Tv_App : hd:term -> a:argv -> named_term_view
| Tv_Abs : b:binder -> body:term -> named_term_view
| Tv_Arrow : b:binder -> c:comp -> named_term_view
| Tv_Type : universe -> named_term_view
| Tv_Refine : b:simple_binder -> ref:term -> named_term_view
| Tv_Const : vconst -> named_term_view
| Tv_Uvar : nat -> ctx_uvar_and_subst -> named_term_view
| Tv_Let : recf:bool -> attrs:(list term) -> b:simple_binder -> def:term -> body:term -> named_term_view
| Tv_Match : scrutinee:term -> ret:option match_returns_ascription -> brs:(list branch) -> named_term_view
| Tv_AscribedT : e:term -> t:term -> tac:option term -> use_eq:bool -> named_term_view
| Tv_AscribedC : e:term -> c:comp -> tac:option term -> use_eq:bool -> named_term_view
| Tv_Unknown : named_term_view // An underscore: _
| Tv_Unsupp : named_term_view // failed to inspect, not supported
// Repeat from FStar.R.Data
let notAscription (tv:named_term_view) : bool =
not (Tv_AscribedT? tv) && not (Tv_AscribedC? tv)
[@@plugin]
noeq
type letbinding = {
lb_fv : fv;
lb_us : list univ_name; (* opened *)
lb_typ : typ;
lb_def : term;
}
[@@plugin]
noeq
type named_sigelt_view =
| Sg_Let {
isrec : bool;
lbs : list letbinding;
}
// Sg_Inductive basically coalesces the Sig_bundle used internally,
// where the type definition and its constructors are split.
// While that might be better for typechecking, this is probably better for metaprogrammers
// (no mutually defined types for now)
| Sg_Inductive {
nm : name; // name of the inductive type being defined
univs : list univ_name; // named universe variables
params : binders; // parameters
typ : typ; // the type annotation for the inductive, i.e., indices -> Type #u
ctors : list ctor; // the constructors, opened with univs and applied to params already
}
| Sg_Val {
nm : name;
univs : list univ_name;
typ : typ;
}
| Unk
(* Some helpers. The latter two are not marked coercions as they make a
choice to not add qualifiers/attrs, so we let the user call them. *)
[@@coercion]
let binder_to_binding (b : binder) : binding =
{
ppname = b.ppname;
uniq = b.uniq;
sort = b.sort;
}
let binding_to_binder (bnd : binding) : binder =
{
ppname = bnd.ppname;
uniq = bnd.uniq;
sort = bnd.sort;
qual = Q_Explicit;
attrs = []
}
let namedv_to_binder (v : namedv) (sort : term) : binder =
{
uniq = v.uniq;
sort = sort;
ppname = v.ppname;
qual = Q_Explicit;
attrs = [];
}
[@@plugin; coercion]
val inspect_universe (u:universe) : Tot named_universe_view
[@@plugin; coercion]
val pack_universe (uv:named_universe_view) : Tot universe
[@@plugin]
val close_term (b:binder) (t:term) : Tot (R.binder & term)
[@@plugin; coercion]
val inspect (t:term) : Tac named_term_view
[@@plugin; coercion]
val pack (tv:named_term_view) : Tot term
[@@plugin; coercion]
val inspect_sigelt (s : sigelt) : Tac named_sigelt_view
[@@plugin; coercion]
val pack_sigelt (sv:named_sigelt_view{~(Unk? sv)}) : Tac sigelt
(* Some primitives mention `R.comp`, wrap them to use `ThisModule.comp = R.comp_view` *)
[@@plugin]
val tcc (e:env) (t:term) : Tac comp
[@@plugin]
val comp_to_string (c:comp) : Tac string
(* Clients of this module use the named view. *)
let universe_view = named_universe_view
let term_view = named_term_view
let sigelt_view = named_sigelt_view
(* Temporary adapters, to avoid breaking existing code too much. *)
let inspect_namedv = id #namedv | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.NamedView.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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.Tactics.NamedView.bv -> FStar.Tactics.NamedView.bv | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.id",
"FStar.Tactics.NamedView.bv"
] | [] | false | false | false | true | false | let inspect_bv =
| id #bv | false |
|
FStar.Tactics.NamedView.fsti | FStar.Tactics.NamedView.pack_bv | val pack_bv : x: FStar.Tactics.NamedView.bv -> FStar.Tactics.NamedView.bv | let pack_bv = id #bv | {
"file_name": "ulib/FStar.Tactics.NamedView.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 29,
"end_line": 215,
"start_col": 0,
"start_line": 215
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.NamedView
open FStar.Tactics.Effect
open FStar.Reflection.V2
module R = FStar.Reflection.V2
(* Re export the syntax types. Expose variables as their views, users do
not need to pack/inspect these if they are using the named view. *)
type namedv = R.namedv_view
type bv = R.bv_view
type comp = R.comp_view
type binding = R.binding (* already good *)
(* Terms and universes are still *deep*, so we do not change their
representation, and the user needs to pack/inspect. *)
type term = R.term
type universe = R.universe
[@@plugin]
noeq
type binder = {
uniq : nat;
ppname : ppname_t;
sort : R.typ;
qual : aqualv;
attrs : list term;
}
type binders = list binder
let is_simple_binder (b:binder) = Q_Explicit? b.qual /\ Nil? b.attrs
type simple_binder = b:binder{is_simple_binder b}
type univ_name = string & Range.range
[@@plugin]
noeq
type named_universe_view =
| Uv_Zero : named_universe_view
| Uv_Succ : universe -> named_universe_view
| Uv_Max : universes -> named_universe_view
| Uv_BVar : nat -> named_universe_view
| Uv_Name : univ_name -> named_universe_view
| Uv_Unif : R.universe_uvar -> named_universe_view
| Uv_Unk : named_universe_view
[@@plugin]
noeq
type pattern =
// A built-in constant
| Pat_Constant {
c : vconst
}
// A fully applied constructor, each boolean marks whether the
// argument was an explicitly-provided implicit argument
| Pat_Cons {
head : fv;
univs : option universes;
subpats : list (pattern * bool)
}
// A pattern-bound *named* variable.
| Pat_Var {
v : namedv;
sort : sealed typ;
}
// Dot pattern: resolved by other elements in the pattern and type
| Pat_Dot_Term {
t : option term;
}
type branch = pattern & term
type match_returns_ascription = binder & (either term comp & option term & bool)
[@@plugin]
noeq
type named_term_view =
| Tv_Var : v:namedv -> named_term_view
| Tv_BVar : v:bv -> named_term_view
| Tv_FVar : v:fv -> named_term_view
| Tv_UInst : v:fv -> us:universes -> named_term_view
| Tv_App : hd:term -> a:argv -> named_term_view
| Tv_Abs : b:binder -> body:term -> named_term_view
| Tv_Arrow : b:binder -> c:comp -> named_term_view
| Tv_Type : universe -> named_term_view
| Tv_Refine : b:simple_binder -> ref:term -> named_term_view
| Tv_Const : vconst -> named_term_view
| Tv_Uvar : nat -> ctx_uvar_and_subst -> named_term_view
| Tv_Let : recf:bool -> attrs:(list term) -> b:simple_binder -> def:term -> body:term -> named_term_view
| Tv_Match : scrutinee:term -> ret:option match_returns_ascription -> brs:(list branch) -> named_term_view
| Tv_AscribedT : e:term -> t:term -> tac:option term -> use_eq:bool -> named_term_view
| Tv_AscribedC : e:term -> c:comp -> tac:option term -> use_eq:bool -> named_term_view
| Tv_Unknown : named_term_view // An underscore: _
| Tv_Unsupp : named_term_view // failed to inspect, not supported
// Repeat from FStar.R.Data
let notAscription (tv:named_term_view) : bool =
not (Tv_AscribedT? tv) && not (Tv_AscribedC? tv)
[@@plugin]
noeq
type letbinding = {
lb_fv : fv;
lb_us : list univ_name; (* opened *)
lb_typ : typ;
lb_def : term;
}
[@@plugin]
noeq
type named_sigelt_view =
| Sg_Let {
isrec : bool;
lbs : list letbinding;
}
// Sg_Inductive basically coalesces the Sig_bundle used internally,
// where the type definition and its constructors are split.
// While that might be better for typechecking, this is probably better for metaprogrammers
// (no mutually defined types for now)
| Sg_Inductive {
nm : name; // name of the inductive type being defined
univs : list univ_name; // named universe variables
params : binders; // parameters
typ : typ; // the type annotation for the inductive, i.e., indices -> Type #u
ctors : list ctor; // the constructors, opened with univs and applied to params already
}
| Sg_Val {
nm : name;
univs : list univ_name;
typ : typ;
}
| Unk
(* Some helpers. The latter two are not marked coercions as they make a
choice to not add qualifiers/attrs, so we let the user call them. *)
[@@coercion]
let binder_to_binding (b : binder) : binding =
{
ppname = b.ppname;
uniq = b.uniq;
sort = b.sort;
}
let binding_to_binder (bnd : binding) : binder =
{
ppname = bnd.ppname;
uniq = bnd.uniq;
sort = bnd.sort;
qual = Q_Explicit;
attrs = []
}
let namedv_to_binder (v : namedv) (sort : term) : binder =
{
uniq = v.uniq;
sort = sort;
ppname = v.ppname;
qual = Q_Explicit;
attrs = [];
}
[@@plugin; coercion]
val inspect_universe (u:universe) : Tot named_universe_view
[@@plugin; coercion]
val pack_universe (uv:named_universe_view) : Tot universe
[@@plugin]
val close_term (b:binder) (t:term) : Tot (R.binder & term)
[@@plugin; coercion]
val inspect (t:term) : Tac named_term_view
[@@plugin; coercion]
val pack (tv:named_term_view) : Tot term
[@@plugin; coercion]
val inspect_sigelt (s : sigelt) : Tac named_sigelt_view
[@@plugin; coercion]
val pack_sigelt (sv:named_sigelt_view{~(Unk? sv)}) : Tac sigelt
(* Some primitives mention `R.comp`, wrap them to use `ThisModule.comp = R.comp_view` *)
[@@plugin]
val tcc (e:env) (t:term) : Tac comp
[@@plugin]
val comp_to_string (c:comp) : Tac string
(* Clients of this module use the named view. *)
let universe_view = named_universe_view
let term_view = named_term_view
let sigelt_view = named_sigelt_view
(* Temporary adapters, to avoid breaking existing code too much. *)
let inspect_namedv = id #namedv
let pack_namedv = id #namedv | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.NamedView.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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.Tactics.NamedView.bv -> FStar.Tactics.NamedView.bv | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.id",
"FStar.Tactics.NamedView.bv"
] | [] | false | false | false | true | false | let pack_bv =
| id #bv | false |
|
FStar.Tactics.NamedView.fsti | FStar.Tactics.NamedView.pack_comp | val pack_comp : x: FStar.Tactics.NamedView.comp -> FStar.Tactics.NamedView.comp | let pack_comp = id #comp | {
"file_name": "ulib/FStar.Tactics.NamedView.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 31,
"end_line": 217,
"start_col": 0,
"start_line": 217
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.NamedView
open FStar.Tactics.Effect
open FStar.Reflection.V2
module R = FStar.Reflection.V2
(* Re export the syntax types. Expose variables as their views, users do
not need to pack/inspect these if they are using the named view. *)
type namedv = R.namedv_view
type bv = R.bv_view
type comp = R.comp_view
type binding = R.binding (* already good *)
(* Terms and universes are still *deep*, so we do not change their
representation, and the user needs to pack/inspect. *)
type term = R.term
type universe = R.universe
[@@plugin]
noeq
type binder = {
uniq : nat;
ppname : ppname_t;
sort : R.typ;
qual : aqualv;
attrs : list term;
}
type binders = list binder
let is_simple_binder (b:binder) = Q_Explicit? b.qual /\ Nil? b.attrs
type simple_binder = b:binder{is_simple_binder b}
type univ_name = string & Range.range
[@@plugin]
noeq
type named_universe_view =
| Uv_Zero : named_universe_view
| Uv_Succ : universe -> named_universe_view
| Uv_Max : universes -> named_universe_view
| Uv_BVar : nat -> named_universe_view
| Uv_Name : univ_name -> named_universe_view
| Uv_Unif : R.universe_uvar -> named_universe_view
| Uv_Unk : named_universe_view
[@@plugin]
noeq
type pattern =
// A built-in constant
| Pat_Constant {
c : vconst
}
// A fully applied constructor, each boolean marks whether the
// argument was an explicitly-provided implicit argument
| Pat_Cons {
head : fv;
univs : option universes;
subpats : list (pattern * bool)
}
// A pattern-bound *named* variable.
| Pat_Var {
v : namedv;
sort : sealed typ;
}
// Dot pattern: resolved by other elements in the pattern and type
| Pat_Dot_Term {
t : option term;
}
type branch = pattern & term
type match_returns_ascription = binder & (either term comp & option term & bool)
[@@plugin]
noeq
type named_term_view =
| Tv_Var : v:namedv -> named_term_view
| Tv_BVar : v:bv -> named_term_view
| Tv_FVar : v:fv -> named_term_view
| Tv_UInst : v:fv -> us:universes -> named_term_view
| Tv_App : hd:term -> a:argv -> named_term_view
| Tv_Abs : b:binder -> body:term -> named_term_view
| Tv_Arrow : b:binder -> c:comp -> named_term_view
| Tv_Type : universe -> named_term_view
| Tv_Refine : b:simple_binder -> ref:term -> named_term_view
| Tv_Const : vconst -> named_term_view
| Tv_Uvar : nat -> ctx_uvar_and_subst -> named_term_view
| Tv_Let : recf:bool -> attrs:(list term) -> b:simple_binder -> def:term -> body:term -> named_term_view
| Tv_Match : scrutinee:term -> ret:option match_returns_ascription -> brs:(list branch) -> named_term_view
| Tv_AscribedT : e:term -> t:term -> tac:option term -> use_eq:bool -> named_term_view
| Tv_AscribedC : e:term -> c:comp -> tac:option term -> use_eq:bool -> named_term_view
| Tv_Unknown : named_term_view // An underscore: _
| Tv_Unsupp : named_term_view // failed to inspect, not supported
// Repeat from FStar.R.Data
let notAscription (tv:named_term_view) : bool =
not (Tv_AscribedT? tv) && not (Tv_AscribedC? tv)
[@@plugin]
noeq
type letbinding = {
lb_fv : fv;
lb_us : list univ_name; (* opened *)
lb_typ : typ;
lb_def : term;
}
[@@plugin]
noeq
type named_sigelt_view =
| Sg_Let {
isrec : bool;
lbs : list letbinding;
}
// Sg_Inductive basically coalesces the Sig_bundle used internally,
// where the type definition and its constructors are split.
// While that might be better for typechecking, this is probably better for metaprogrammers
// (no mutually defined types for now)
| Sg_Inductive {
nm : name; // name of the inductive type being defined
univs : list univ_name; // named universe variables
params : binders; // parameters
typ : typ; // the type annotation for the inductive, i.e., indices -> Type #u
ctors : list ctor; // the constructors, opened with univs and applied to params already
}
| Sg_Val {
nm : name;
univs : list univ_name;
typ : typ;
}
| Unk
(* Some helpers. The latter two are not marked coercions as they make a
choice to not add qualifiers/attrs, so we let the user call them. *)
[@@coercion]
let binder_to_binding (b : binder) : binding =
{
ppname = b.ppname;
uniq = b.uniq;
sort = b.sort;
}
let binding_to_binder (bnd : binding) : binder =
{
ppname = bnd.ppname;
uniq = bnd.uniq;
sort = bnd.sort;
qual = Q_Explicit;
attrs = []
}
let namedv_to_binder (v : namedv) (sort : term) : binder =
{
uniq = v.uniq;
sort = sort;
ppname = v.ppname;
qual = Q_Explicit;
attrs = [];
}
[@@plugin; coercion]
val inspect_universe (u:universe) : Tot named_universe_view
[@@plugin; coercion]
val pack_universe (uv:named_universe_view) : Tot universe
[@@plugin]
val close_term (b:binder) (t:term) : Tot (R.binder & term)
[@@plugin; coercion]
val inspect (t:term) : Tac named_term_view
[@@plugin; coercion]
val pack (tv:named_term_view) : Tot term
[@@plugin; coercion]
val inspect_sigelt (s : sigelt) : Tac named_sigelt_view
[@@plugin; coercion]
val pack_sigelt (sv:named_sigelt_view{~(Unk? sv)}) : Tac sigelt
(* Some primitives mention `R.comp`, wrap them to use `ThisModule.comp = R.comp_view` *)
[@@plugin]
val tcc (e:env) (t:term) : Tac comp
[@@plugin]
val comp_to_string (c:comp) : Tac string
(* Clients of this module use the named view. *)
let universe_view = named_universe_view
let term_view = named_term_view
let sigelt_view = named_sigelt_view
(* Temporary adapters, to avoid breaking existing code too much. *)
let inspect_namedv = id #namedv
let pack_namedv = id #namedv
let inspect_bv = id #bv
let pack_bv = id #bv | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.NamedView.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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.Tactics.NamedView.comp -> FStar.Tactics.NamedView.comp | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.id",
"FStar.Tactics.NamedView.comp"
] | [] | false | false | false | true | false | let pack_comp =
| id #comp | false |
|
FStar.Tactics.NamedView.fsti | FStar.Tactics.NamedView.inspect_comp | val inspect_comp : x: FStar.Tactics.NamedView.comp -> FStar.Tactics.NamedView.comp | let inspect_comp = id #comp | {
"file_name": "ulib/FStar.Tactics.NamedView.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 31,
"end_line": 216,
"start_col": 0,
"start_line": 216
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.NamedView
open FStar.Tactics.Effect
open FStar.Reflection.V2
module R = FStar.Reflection.V2
(* Re export the syntax types. Expose variables as their views, users do
not need to pack/inspect these if they are using the named view. *)
type namedv = R.namedv_view
type bv = R.bv_view
type comp = R.comp_view
type binding = R.binding (* already good *)
(* Terms and universes are still *deep*, so we do not change their
representation, and the user needs to pack/inspect. *)
type term = R.term
type universe = R.universe
[@@plugin]
noeq
type binder = {
uniq : nat;
ppname : ppname_t;
sort : R.typ;
qual : aqualv;
attrs : list term;
}
type binders = list binder
let is_simple_binder (b:binder) = Q_Explicit? b.qual /\ Nil? b.attrs
type simple_binder = b:binder{is_simple_binder b}
type univ_name = string & Range.range
[@@plugin]
noeq
type named_universe_view =
| Uv_Zero : named_universe_view
| Uv_Succ : universe -> named_universe_view
| Uv_Max : universes -> named_universe_view
| Uv_BVar : nat -> named_universe_view
| Uv_Name : univ_name -> named_universe_view
| Uv_Unif : R.universe_uvar -> named_universe_view
| Uv_Unk : named_universe_view
[@@plugin]
noeq
type pattern =
// A built-in constant
| Pat_Constant {
c : vconst
}
// A fully applied constructor, each boolean marks whether the
// argument was an explicitly-provided implicit argument
| Pat_Cons {
head : fv;
univs : option universes;
subpats : list (pattern * bool)
}
// A pattern-bound *named* variable.
| Pat_Var {
v : namedv;
sort : sealed typ;
}
// Dot pattern: resolved by other elements in the pattern and type
| Pat_Dot_Term {
t : option term;
}
type branch = pattern & term
type match_returns_ascription = binder & (either term comp & option term & bool)
[@@plugin]
noeq
type named_term_view =
| Tv_Var : v:namedv -> named_term_view
| Tv_BVar : v:bv -> named_term_view
| Tv_FVar : v:fv -> named_term_view
| Tv_UInst : v:fv -> us:universes -> named_term_view
| Tv_App : hd:term -> a:argv -> named_term_view
| Tv_Abs : b:binder -> body:term -> named_term_view
| Tv_Arrow : b:binder -> c:comp -> named_term_view
| Tv_Type : universe -> named_term_view
| Tv_Refine : b:simple_binder -> ref:term -> named_term_view
| Tv_Const : vconst -> named_term_view
| Tv_Uvar : nat -> ctx_uvar_and_subst -> named_term_view
| Tv_Let : recf:bool -> attrs:(list term) -> b:simple_binder -> def:term -> body:term -> named_term_view
| Tv_Match : scrutinee:term -> ret:option match_returns_ascription -> brs:(list branch) -> named_term_view
| Tv_AscribedT : e:term -> t:term -> tac:option term -> use_eq:bool -> named_term_view
| Tv_AscribedC : e:term -> c:comp -> tac:option term -> use_eq:bool -> named_term_view
| Tv_Unknown : named_term_view // An underscore: _
| Tv_Unsupp : named_term_view // failed to inspect, not supported
// Repeat from FStar.R.Data
let notAscription (tv:named_term_view) : bool =
not (Tv_AscribedT? tv) && not (Tv_AscribedC? tv)
[@@plugin]
noeq
type letbinding = {
lb_fv : fv;
lb_us : list univ_name; (* opened *)
lb_typ : typ;
lb_def : term;
}
[@@plugin]
noeq
type named_sigelt_view =
| Sg_Let {
isrec : bool;
lbs : list letbinding;
}
// Sg_Inductive basically coalesces the Sig_bundle used internally,
// where the type definition and its constructors are split.
// While that might be better for typechecking, this is probably better for metaprogrammers
// (no mutually defined types for now)
| Sg_Inductive {
nm : name; // name of the inductive type being defined
univs : list univ_name; // named universe variables
params : binders; // parameters
typ : typ; // the type annotation for the inductive, i.e., indices -> Type #u
ctors : list ctor; // the constructors, opened with univs and applied to params already
}
| Sg_Val {
nm : name;
univs : list univ_name;
typ : typ;
}
| Unk
(* Some helpers. The latter two are not marked coercions as they make a
choice to not add qualifiers/attrs, so we let the user call them. *)
[@@coercion]
let binder_to_binding (b : binder) : binding =
{
ppname = b.ppname;
uniq = b.uniq;
sort = b.sort;
}
let binding_to_binder (bnd : binding) : binder =
{
ppname = bnd.ppname;
uniq = bnd.uniq;
sort = bnd.sort;
qual = Q_Explicit;
attrs = []
}
let namedv_to_binder (v : namedv) (sort : term) : binder =
{
uniq = v.uniq;
sort = sort;
ppname = v.ppname;
qual = Q_Explicit;
attrs = [];
}
[@@plugin; coercion]
val inspect_universe (u:universe) : Tot named_universe_view
[@@plugin; coercion]
val pack_universe (uv:named_universe_view) : Tot universe
[@@plugin]
val close_term (b:binder) (t:term) : Tot (R.binder & term)
[@@plugin; coercion]
val inspect (t:term) : Tac named_term_view
[@@plugin; coercion]
val pack (tv:named_term_view) : Tot term
[@@plugin; coercion]
val inspect_sigelt (s : sigelt) : Tac named_sigelt_view
[@@plugin; coercion]
val pack_sigelt (sv:named_sigelt_view{~(Unk? sv)}) : Tac sigelt
(* Some primitives mention `R.comp`, wrap them to use `ThisModule.comp = R.comp_view` *)
[@@plugin]
val tcc (e:env) (t:term) : Tac comp
[@@plugin]
val comp_to_string (c:comp) : Tac string
(* Clients of this module use the named view. *)
let universe_view = named_universe_view
let term_view = named_term_view
let sigelt_view = named_sigelt_view
(* Temporary adapters, to avoid breaking existing code too much. *)
let inspect_namedv = id #namedv
let pack_namedv = id #namedv
let inspect_bv = id #bv | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.NamedView.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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.Tactics.NamedView.comp -> FStar.Tactics.NamedView.comp | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.id",
"FStar.Tactics.NamedView.comp"
] | [] | false | false | false | true | false | let inspect_comp =
| id #comp | false |
|
Vale.Stdcalls.X64.Aes.fsti | Vale.Stdcalls.X64.Aes.lowstar_key128_t | val lowstar_key128_t : Type0 | let lowstar_key128_t =
assert_norm (List.length dom + List.length ([]<:list arg) <= 4);
IX64.as_lowstar_sig_t_weak_stdcall
code_key128
dom
[]
_
_
(W.mk_prediction code_key128 dom [] (key128_lemma code_key128 IA.win)) | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.Aes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 74,
"end_line": 108,
"start_col": 0,
"start_line": 100
} | module Vale.Stdcalls.X64.Aes
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
open Vale.AES.AES_s
module AE = Vale.AES.X64.AES
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__] noextract
let dom: IX64.arity_ok_stdcall td =
let y = [t128_no_mod; t128_mod] in
assert_norm (List.length y = 2);
y
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let key128_pre : VSig.vale_pre dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state) ->
AE.va_req_KeyExpansionStdcall c va_s0 IA.win AES_128
(as_vale_buffer input_b) (as_vale_buffer output_b)
[@__reduce__] noextract
let key128_post : VSig.vale_post dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
AE.va_ens_KeyExpansionStdcall c va_s0 IA.win AES_128 (as_vale_buffer input_b) (as_vale_buffer output_b) va_s1 f
#set-options "--z3rlimit 20"
[@__reduce__] noextract
let key128_lemma'
(code:V.va_code)
(_win:bool)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
key128_pre code input_b output_b va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
key128_post code input_b output_b va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer input_b) /\
ME.buffer_writeable (as_vale_buffer output_b)
)) =
let va_s1, f = AE.va_lemma_KeyExpansionStdcall code va_s0 IA.win AES_128
(as_vale_buffer input_b) (as_vale_buffer output_b) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 input_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 output_b;
(va_s1, f)
noextract
let key128_lemma = as_t #(VSig.vale_sig_stdcall key128_pre key128_post) key128_lemma'
noextract
let code_key128 = AE.va_code_KeyExpansionStdcall IA.win AES_128 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.Aes.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.AES",
"short_module": "AE"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.Interop.X64.as_lowstar_sig_t_weak_stdcall",
"Vale.Stdcalls.X64.Aes.code_key128",
"Vale.Stdcalls.X64.Aes.dom",
"Prims.Nil",
"Vale.Interop.Base.arg",
"Vale.AsLowStar.Wrapper.pre_rel_generic",
"Vale.Interop.X64.max_stdcall",
"Vale.Interop.X64.arg_reg_stdcall",
"Vale.Stdcalls.X64.Aes.key128_pre",
"Vale.AsLowStar.Wrapper.post_rel_generic",
"Vale.Stdcalls.X64.Aes.key128_post",
"Vale.AsLowStar.Wrapper.mk_prediction",
"Vale.Interop.X64.regs_modified_stdcall",
"Vale.Interop.X64.xmms_modified_stdcall",
"Vale.Stdcalls.X64.Aes.key128_lemma",
"Vale.Interop.Assumptions.win",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"FStar.List.Tot.Base.length",
"Vale.Interop.Base.td",
"Prims.list"
] | [] | false | false | false | true | true | let lowstar_key128_t =
| assert_norm (List.length dom + List.length ([] <: list arg) <= 4);
IX64.as_lowstar_sig_t_weak_stdcall code_key128
dom
[]
_
_
(W.mk_prediction code_key128 dom [] (key128_lemma code_key128 IA.win)) | false |
|
Vale.Lib.Meta.fst | Vale.Lib.Meta.generic_injective_proof | val generic_injective_proof
(#a:eqtype) (#b:eqtype) (f:a -> b) (g:b -> a) (l:(x:a -> Lemma (g (f x) == x)))
: Lemma (forall (x x':a).{:pattern f x; f x'} f x == f x' ==> x == x') | val generic_injective_proof
(#a:eqtype) (#b:eqtype) (f:a -> b) (g:b -> a) (l:(x:a -> Lemma (g (f x) == x)))
: Lemma (forall (x x':a).{:pattern f x; f x'} f x == f x' ==> x == x') | let generic_injective_proof #a #b f g l =
let helper (x x':a) : Lemma (f x == f x' ==> x == x') =
if f x = f x' then
if not (x = x') then (
let y = f x in
let y' = f x' in
assert (y == y');
let z = g y in
let z' = g y' in
assert (z == z');
l x;
assert (z == x);
l x';
assert (z' == x');
()
) else ()
else
()
in
FStar.Classical.forall_intro_2 helper;
() | {
"file_name": "vale/code/lib/util/Vale.Lib.Meta.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 4,
"end_line": 24,
"start_col": 0,
"start_line": 4
} | module Vale.Lib.Meta
open FStar.Mul | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.Lib.Meta.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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": 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 | f: (_: a -> b) -> g: (_: b -> a) -> l: (x: a -> FStar.Pervasives.Lemma (ensures g (f x) == x))
-> FStar.Pervasives.Lemma
(ensures forall (x: a) (x': a). {:pattern f x; f x'} f x == f x' ==> x == x') | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.eqtype",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"Prims.Nil",
"FStar.Pervasives.pattern",
"FStar.Classical.forall_intro_2",
"Prims.l_imp",
"Prims.op_Equality",
"Prims.op_Negation",
"Prims._assert",
"Prims.bool"
] | [] | false | false | true | false | false | let generic_injective_proof #a #b f g l =
| let helper (x x': a) : Lemma (f x == f x' ==> x == x') =
if f x = f x'
then
if not (x = x')
then
(let y = f x in
let y' = f x' in
assert (y == y');
let z = g y in
let z' = g y' in
assert (z == z');
l x;
assert (z == x);
l x';
assert (z' == x');
())
in
FStar.Classical.forall_intro_2 helper;
() | false |
Vale.Lib.Meta.fst | Vale.Lib.Meta.exists_elim2 | val exists_elim2
(goal:Type) (#a:Type) (#b:(a -> Type)) (#p:(x:a -> b x -> Type))
(_:squash (exists (x:a) (y:b x). p x y))
(f:(x:a -> y:b x{p x y} -> GTot (squash goal)))
: Lemma goal | val exists_elim2
(goal:Type) (#a:Type) (#b:(a -> Type)) (#p:(x:a -> b x -> Type))
(_:squash (exists (x:a) (y:b x). p x y))
(f:(x:a -> y:b x{p x y} -> GTot (squash goal)))
: Lemma goal | let exists_elim2 goal #a #b #p _ f =
let open FStar.Classical in
exists_elim goal () (fun (x:a{exists (y:b x). p x y}) ->
exists_elim goal () (fun (y:b x{p x y}) ->
f x y)) | {
"file_name": "vale/code/lib/util/Vale.Lib.Meta.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 13,
"end_line": 31,
"start_col": 0,
"start_line": 27
} | module Vale.Lib.Meta
open FStar.Mul
let generic_injective_proof #a #b f g l =
let helper (x x':a) : Lemma (f x == f x' ==> x == x') =
if f x = f x' then
if not (x = x') then (
let y = f x in
let y' = f x' in
assert (y == y');
let z = g y in
let z' = g y' in
assert (z == z');
l x;
assert (z == x);
l x';
assert (z' == x');
()
) else ()
else
()
in
FStar.Classical.forall_intro_2 helper;
() | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.Lib.Meta.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.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": 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 |
goal: Type0 ->
_: Prims.squash (exists (x: a) (y: b x). p x y) ->
f: (x: a -> y: b x {p x y} -> Prims.GTot (Prims.squash goal))
-> FStar.Pervasives.Lemma (ensures goal) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.squash",
"Prims.l_Exists",
"FStar.Classical.exists_elim",
"Prims.unit"
] | [] | false | false | true | false | false | let exists_elim2 goal #a #b #p _ f =
| let open FStar.Classical in
exists_elim goal
()
(fun (x: a{exists (y: b x). p x y}) -> exists_elim goal () (fun (y: b x {p x y}) -> f x y)) | false |
SfPoly.fst | SfPoly.length | val length : list 'a -> Tot nat | val length : list 'a -> Tot nat | let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 27,
"end_line": 32,
"start_col": 0,
"start_line": 29
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | l: Prims.list 'a -> Prims.nat | Prims.Tot | [
"total"
] | [] | [
"Prims.list",
"Prims.op_Addition",
"SfPoly.length",
"Prims.nat"
] | [
"recursion"
] | false | false | false | true | false | let rec length l =
| match l with
| [] -> 0
| hd :: tl -> 1 + length tl | false |
Vale.Stdcalls.X64.Aes.fsti | Vale.Stdcalls.X64.Aes.key128_lemma | val key128_lemma : Vale.AsLowStar.ValeSig.vale_sig_stdcall Vale.Stdcalls.X64.Aes.key128_pre
Vale.Stdcalls.X64.Aes.key128_post | let key128_lemma = as_t #(VSig.vale_sig_stdcall key128_pre key128_post) key128_lemma' | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.Aes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 85,
"end_line": 94,
"start_col": 0,
"start_line": 94
} | module Vale.Stdcalls.X64.Aes
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
open Vale.AES.AES_s
module AE = Vale.AES.X64.AES
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__] noextract
let dom: IX64.arity_ok_stdcall td =
let y = [t128_no_mod; t128_mod] in
assert_norm (List.length y = 2);
y
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let key128_pre : VSig.vale_pre dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state) ->
AE.va_req_KeyExpansionStdcall c va_s0 IA.win AES_128
(as_vale_buffer input_b) (as_vale_buffer output_b)
[@__reduce__] noextract
let key128_post : VSig.vale_post dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
AE.va_ens_KeyExpansionStdcall c va_s0 IA.win AES_128 (as_vale_buffer input_b) (as_vale_buffer output_b) va_s1 f
#set-options "--z3rlimit 20"
[@__reduce__] noextract
let key128_lemma'
(code:V.va_code)
(_win:bool)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
key128_pre code input_b output_b va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
key128_post code input_b output_b va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer input_b) /\
ME.buffer_writeable (as_vale_buffer output_b)
)) =
let va_s1, f = AE.va_lemma_KeyExpansionStdcall code va_s0 IA.win AES_128
(as_vale_buffer input_b) (as_vale_buffer output_b) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 input_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 output_b;
(va_s1, f) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.Aes.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.AES",
"short_module": "AE"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Vale.AsLowStar.ValeSig.vale_sig_stdcall Vale.Stdcalls.X64.Aes.key128_pre
Vale.Stdcalls.X64.Aes.key128_post | Prims.Tot | [
"total"
] | [] | [
"Vale.Stdcalls.X64.Aes.as_t",
"Vale.AsLowStar.ValeSig.vale_sig_stdcall",
"Vale.Stdcalls.X64.Aes.dom",
"Vale.Stdcalls.X64.Aes.key128_pre",
"Vale.Stdcalls.X64.Aes.key128_post",
"Vale.Stdcalls.X64.Aes.key128_lemma'"
] | [] | false | false | false | true | false | let key128_lemma =
| as_t #(VSig.vale_sig_stdcall key128_pre key128_post) key128_lemma' | false |
|
SfPoly.fst | SfPoly.app | val app : list 'a -> list 'a -> Tot (list 'a) | val app : list 'a -> list 'a -> Tot (list 'a) | let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2 | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 25,
"end_line": 54,
"start_col": 0,
"start_line": 51
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = () | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 | l1: Prims.list 'a -> l2: Prims.list 'a -> Prims.list 'a | Prims.Tot | [
"total"
] | [] | [
"Prims.list",
"Prims.Cons",
"SfPoly.app"
] | [
"recursion"
] | false | false | false | true | false | let rec app l1 l2 =
| match l1 with
| [] -> l2
| h :: t -> h :: app t l2 | false |
Vale.Stdcalls.X64.Aes.fsti | Vale.Stdcalls.X64.Aes.key256_lemma | val key256_lemma : Vale.AsLowStar.ValeSig.vale_sig_stdcall Vale.Stdcalls.X64.Aes.key256_pre
Vale.Stdcalls.X64.Aes.key256_post | let key256_lemma = as_t #(VSig.vale_sig_stdcall key256_pre key256_post) key256_lemma' | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.Aes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 85,
"end_line": 157,
"start_col": 0,
"start_line": 157
} | module Vale.Stdcalls.X64.Aes
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
open Vale.AES.AES_s
module AE = Vale.AES.X64.AES
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__] noextract
let dom: IX64.arity_ok_stdcall td =
let y = [t128_no_mod; t128_mod] in
assert_norm (List.length y = 2);
y
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let key128_pre : VSig.vale_pre dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state) ->
AE.va_req_KeyExpansionStdcall c va_s0 IA.win AES_128
(as_vale_buffer input_b) (as_vale_buffer output_b)
[@__reduce__] noextract
let key128_post : VSig.vale_post dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
AE.va_ens_KeyExpansionStdcall c va_s0 IA.win AES_128 (as_vale_buffer input_b) (as_vale_buffer output_b) va_s1 f
#set-options "--z3rlimit 20"
[@__reduce__] noextract
let key128_lemma'
(code:V.va_code)
(_win:bool)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
key128_pre code input_b output_b va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
key128_post code input_b output_b va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer input_b) /\
ME.buffer_writeable (as_vale_buffer output_b)
)) =
let va_s1, f = AE.va_lemma_KeyExpansionStdcall code va_s0 IA.win AES_128
(as_vale_buffer input_b) (as_vale_buffer output_b) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 input_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 output_b;
(va_s1, f)
noextract
let key128_lemma = as_t #(VSig.vale_sig_stdcall key128_pre key128_post) key128_lemma'
noextract
let code_key128 = AE.va_code_KeyExpansionStdcall IA.win AES_128
[@__reduce__] noextract
let lowstar_key128_t =
assert_norm (List.length dom + List.length ([]<:list arg) <= 4);
IX64.as_lowstar_sig_t_weak_stdcall
code_key128
dom
[]
_
_
(W.mk_prediction code_key128 dom [] (key128_lemma code_key128 IA.win))
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let key256_pre : VSig.vale_pre dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state) ->
AE.va_req_KeyExpansionStdcall c va_s0 IA.win AES_256
(as_vale_buffer input_b) (as_vale_buffer output_b)
[@__reduce__] noextract
let key256_post : VSig.vale_post dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
AE.va_ens_KeyExpansionStdcall c va_s0 IA.win AES_256 (as_vale_buffer input_b) (as_vale_buffer output_b) va_s1 f
#set-options "--z3rlimit 20"
[@__reduce__] noextract
let key256_lemma'
(code:V.va_code)
(_win:bool)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
key256_pre code input_b output_b va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
key256_post code input_b output_b va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer input_b) /\
ME.buffer_writeable (as_vale_buffer output_b)
)) =
let va_s1, f = AE.va_lemma_KeyExpansionStdcall code va_s0 IA.win AES_256
(as_vale_buffer input_b) (as_vale_buffer output_b) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 input_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 output_b;
(va_s1, f) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.Aes.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.AES",
"short_module": "AE"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Vale.AsLowStar.ValeSig.vale_sig_stdcall Vale.Stdcalls.X64.Aes.key256_pre
Vale.Stdcalls.X64.Aes.key256_post | Prims.Tot | [
"total"
] | [] | [
"Vale.Stdcalls.X64.Aes.as_t",
"Vale.AsLowStar.ValeSig.vale_sig_stdcall",
"Vale.Stdcalls.X64.Aes.dom",
"Vale.Stdcalls.X64.Aes.key256_pre",
"Vale.Stdcalls.X64.Aes.key256_post",
"Vale.Stdcalls.X64.Aes.key256_lemma'"
] | [] | false | false | false | true | false | let key256_lemma =
| as_t #(VSig.vale_sig_stdcall key256_pre key256_post) key256_lemma' | false |
|
Vale.Stdcalls.X64.Aes.fsti | Vale.Stdcalls.X64.Aes.lowstar_key256_t | val lowstar_key256_t : Type0 | let lowstar_key256_t =
assert_norm (List.length dom + List.length ([]<:list arg) <= 4);
IX64.as_lowstar_sig_t_weak_stdcall
code_key256
dom
[]
_
_
(W.mk_prediction code_key256 dom [] (key256_lemma code_key256 IA.win)) | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.Aes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 74,
"end_line": 171,
"start_col": 0,
"start_line": 163
} | module Vale.Stdcalls.X64.Aes
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
open Vale.AES.AES_s
module AE = Vale.AES.X64.AES
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__] noextract
let dom: IX64.arity_ok_stdcall td =
let y = [t128_no_mod; t128_mod] in
assert_norm (List.length y = 2);
y
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let key128_pre : VSig.vale_pre dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state) ->
AE.va_req_KeyExpansionStdcall c va_s0 IA.win AES_128
(as_vale_buffer input_b) (as_vale_buffer output_b)
[@__reduce__] noextract
let key128_post : VSig.vale_post dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
AE.va_ens_KeyExpansionStdcall c va_s0 IA.win AES_128 (as_vale_buffer input_b) (as_vale_buffer output_b) va_s1 f
#set-options "--z3rlimit 20"
[@__reduce__] noextract
let key128_lemma'
(code:V.va_code)
(_win:bool)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
key128_pre code input_b output_b va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
key128_post code input_b output_b va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer input_b) /\
ME.buffer_writeable (as_vale_buffer output_b)
)) =
let va_s1, f = AE.va_lemma_KeyExpansionStdcall code va_s0 IA.win AES_128
(as_vale_buffer input_b) (as_vale_buffer output_b) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 input_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 output_b;
(va_s1, f)
noextract
let key128_lemma = as_t #(VSig.vale_sig_stdcall key128_pre key128_post) key128_lemma'
noextract
let code_key128 = AE.va_code_KeyExpansionStdcall IA.win AES_128
[@__reduce__] noextract
let lowstar_key128_t =
assert_norm (List.length dom + List.length ([]<:list arg) <= 4);
IX64.as_lowstar_sig_t_weak_stdcall
code_key128
dom
[]
_
_
(W.mk_prediction code_key128 dom [] (key128_lemma code_key128 IA.win))
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let key256_pre : VSig.vale_pre dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state) ->
AE.va_req_KeyExpansionStdcall c va_s0 IA.win AES_256
(as_vale_buffer input_b) (as_vale_buffer output_b)
[@__reduce__] noextract
let key256_post : VSig.vale_post dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
AE.va_ens_KeyExpansionStdcall c va_s0 IA.win AES_256 (as_vale_buffer input_b) (as_vale_buffer output_b) va_s1 f
#set-options "--z3rlimit 20"
[@__reduce__] noextract
let key256_lemma'
(code:V.va_code)
(_win:bool)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
key256_pre code input_b output_b va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
key256_post code input_b output_b va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer input_b) /\
ME.buffer_writeable (as_vale_buffer output_b)
)) =
let va_s1, f = AE.va_lemma_KeyExpansionStdcall code va_s0 IA.win AES_256
(as_vale_buffer input_b) (as_vale_buffer output_b) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 input_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 output_b;
(va_s1, f)
noextract
let key256_lemma = as_t #(VSig.vale_sig_stdcall key256_pre key256_post) key256_lemma'
noextract
let code_key256 = AE.va_code_KeyExpansionStdcall IA.win AES_256 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.Aes.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.AES",
"short_module": "AE"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.Interop.X64.as_lowstar_sig_t_weak_stdcall",
"Vale.Stdcalls.X64.Aes.code_key256",
"Vale.Stdcalls.X64.Aes.dom",
"Prims.Nil",
"Vale.Interop.Base.arg",
"Vale.AsLowStar.Wrapper.pre_rel_generic",
"Vale.Interop.X64.max_stdcall",
"Vale.Interop.X64.arg_reg_stdcall",
"Vale.Stdcalls.X64.Aes.key256_pre",
"Vale.AsLowStar.Wrapper.post_rel_generic",
"Vale.Stdcalls.X64.Aes.key256_post",
"Vale.AsLowStar.Wrapper.mk_prediction",
"Vale.Interop.X64.regs_modified_stdcall",
"Vale.Interop.X64.xmms_modified_stdcall",
"Vale.Stdcalls.X64.Aes.key256_lemma",
"Vale.Interop.Assumptions.win",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"FStar.List.Tot.Base.length",
"Vale.Interop.Base.td",
"Prims.list"
] | [] | false | false | false | true | true | let lowstar_key256_t =
| assert_norm (List.length dom + List.length ([] <: list arg) <= 4);
IX64.as_lowstar_sig_t_weak_stdcall code_key256
dom
[]
_
_
(W.mk_prediction code_key256 dom [] (key256_lemma code_key256 IA.win)) | false |
|
SfPoly.fst | SfPoly.length_app | val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2)) | val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2)) | let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2 | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 27,
"end_line": 72,
"start_col": 0,
"start_line": 69
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 | l1: Prims.list 'a -> l2: Prims.list 'a
-> FStar.Pervasives.Lemma
(ensures SfPoly.length (SfPoly.app l1 l2) = SfPoly.length l1 + SfPoly.length l2) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.list",
"SfPoly.length_app",
"Prims.unit"
] | [
"recursion"
] | false | false | true | false | false | let rec length_app l1 l2 =
| match l1 with
| [] -> ()
| h :: t -> length_app t l2 | false |
SfPoly.fst | SfPoly.app_nil | val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l)) | val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l)) | let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 21,
"end_line": 65,
"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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | l: Prims.list 'a -> FStar.Pervasives.Lemma (ensures SfPoly.app l [] == l) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.list",
"SfPoly.app_nil",
"Prims.unit"
] | [
"recursion"
] | false | false | true | false | false | let rec app_nil l =
| match l with
| [] -> ()
| h :: t -> app_nil t | false |
SfPoly.fst | SfPoly.rev_involutive | val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l) | val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l) | let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 48,
"end_line": 105,
"start_col": 0,
"start_line": 102
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | l: Prims.list 'a -> FStar.Pervasives.Lemma (ensures SfPoly.rev (SfPoly.rev l) == l) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.list",
"SfPoly.rev_involutive",
"Prims.unit",
"SfPoly.rev_snoc",
"SfPoly.rev"
] | [
"recursion"
] | false | false | true | false | false | let rec rev_involutive l =
| match l with
| [] -> ()
| h :: t ->
rev_snoc h (rev t);
rev_involutive t | false |
SfPoly.fst | SfPoly.rev | val rev : list 'a -> Tot (list 'a) | val rev : list 'a -> Tot (list 'a) | let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 26,
"end_line": 91,
"start_col": 0,
"start_line": 88
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | l: Prims.list 'a -> Prims.list 'a | Prims.Tot | [
"total"
] | [] | [
"Prims.list",
"Prims.Nil",
"SfPoly.snoc",
"SfPoly.rev"
] | [
"recursion"
] | false | false | false | true | false | let rec rev l =
| match l with
| [] -> []
| h :: t -> snoc (rev t) h | false |
SfPoly.fst | SfPoly.snoc_with_append | val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a))) | val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a))) | let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 42,
"end_line": 85,
"start_col": 0,
"start_line": 82
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 | l1: Prims.list 'a -> l2: Prims.list 'a -> a: 'a
-> FStar.Pervasives.Lemma
(ensures SfPoly.snoc (SfPoly.app l1 l2) a == SfPoly.app l1 (SfPoly.snoc l2 a)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.list",
"SfPoly.snoc_with_append",
"Prims.unit"
] | [
"recursion"
] | false | false | true | false | false | let rec snoc_with_append l1 l2 a =
| match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a | false |
SfPoly.fst | SfPoly.rev_snoc | val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l))) | val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l))) | let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 24,
"end_line": 98,
"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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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: 'a -> l: Prims.list 'a
-> FStar.Pervasives.Lemma (ensures SfPoly.rev (SfPoly.snoc l a) == a :: SfPoly.rev l) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.list",
"SfPoly.rev_snoc",
"Prims.unit"
] | [
"recursion"
] | false | false | true | false | false | let rec rev_snoc a l =
| match l with
| [] -> ()
| h :: t -> rev_snoc a t | false |
SfPoly.fst | SfPoly.snoc | val snoc : list 'a -> 'a -> Tot (list 'a) | val snoc : list 'a -> 'a -> Tot (list 'a) | let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 25,
"end_line": 78,
"start_col": 0,
"start_line": 75
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | l: Prims.list 'a -> x: 'a -> Prims.list 'a | Prims.Tot | [
"total"
] | [] | [
"Prims.list",
"Prims.Cons",
"Prims.Nil",
"SfPoly.snoc"
] | [
"recursion"
] | false | false | false | true | false | let rec snoc l x =
| match l with
| [] -> [x]
| h :: t -> h :: snoc t x | false |
SfPoly.fst | SfPoly.repeat | val repeat : 'a -> nat -> list 'a | val repeat : 'a -> nat -> list 'a | let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1)) | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 30,
"end_line": 111,
"start_col": 0,
"start_line": 108
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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: 'a -> n: Prims.nat -> Prims.list 'a | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Prims.Nil",
"Prims.int",
"Prims.Cons",
"SfPoly.repeat",
"Prims.op_Subtraction",
"Prims.list"
] | [
"recursion"
] | false | false | false | true | false | let rec repeat a n =
| match n with
| 0 -> []
| _ -> a :: (repeat a (n - 1)) | false |
SfPoly.fst | SfPoly.combine | val combine : list 'a -> list 'b -> list ('a * 'b) | val combine : list 'a -> list 'b -> list ('a * 'b) | let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb) | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 46,
"end_line": 118,
"start_col": 0,
"start_line": 114
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 | la: Prims.list 'a -> lb: Prims.list 'b -> Prims.list ('a * 'b) | Prims.Tot | [
"total"
] | [] | [
"Prims.list",
"FStar.Pervasives.Native.Mktuple2",
"Prims.Nil",
"FStar.Pervasives.Native.tuple2",
"Prims.Cons",
"SfPoly.combine"
] | [
"recursion"
] | false | false | false | true | false | let rec combine la lb =
| match (la, lb) with
| [], _ -> []
| _, [] -> []
| a :: ta, b :: tb -> (a, b) :: (combine ta tb) | false |
SfPoly.fst | SfPoly.prod_curry | val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c | val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c | let prod_curry f x y = f (x,y) | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 31,
"end_line": 157,
"start_col": 0,
"start_line": 157
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 | f: (_: ('a * 'b) -> 'c) -> x: 'a -> y: 'b -> 'c | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.Mktuple2"
] | [] | false | false | false | true | false | let prod_curry f x y =
| f (x, y) | false |
SfPoly.fst | SfPoly.prod_uncurry | val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c | val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c | let prod_uncurry f xy = f (fst xy) (snd xy) | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 43,
"end_line": 160,
"start_col": 0,
"start_line": 160
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *)
val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c
let prod_curry f x y = f (x,y) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 | f: (_: 'a -> _: 'b -> 'c) -> xy: ('a * 'b) -> 'c | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.fst",
"FStar.Pervasives.Native.snd"
] | [] | false | false | false | true | false | let prod_uncurry f xy =
| f (fst xy) (snd xy) | false |
PointStructDirectDef.fst | PointStructDirectDef.swap | val swap (#v1 #v2: Ghost.erased U32.t) (r1 r2: ref (scalar U32.t))
: STT unit
((r1 `pts_to` (mk_scalar (Ghost.reveal v1)))
`star`
(r2 `pts_to` (mk_scalar (Ghost.reveal v2))))
(fun _ ->
(r1 `pts_to` (mk_scalar (Ghost.reveal v2)))
`star`
(r2 `pts_to` (mk_scalar (Ghost.reveal v1)))) | val swap (#v1 #v2: Ghost.erased U32.t) (r1 r2: ref (scalar U32.t))
: STT unit
((r1 `pts_to` (mk_scalar (Ghost.reveal v1)))
`star`
(r2 `pts_to` (mk_scalar (Ghost.reveal v2))))
(fun _ ->
(r1 `pts_to` (mk_scalar (Ghost.reveal v2)))
`star`
(r2 `pts_to` (mk_scalar (Ghost.reveal v1)))) | let swap (#v1 #v2: Ghost.erased U32.t) (r1 r2: ref (scalar U32.t)) : STT unit
((r1 `pts_to` mk_scalar (Ghost.reveal v1)) `star` (r2 `pts_to` mk_scalar (Ghost.reveal v2)))
(fun _ -> (r1 `pts_to` mk_scalar (Ghost.reveal v2)) `star` (r2 `pts_to` mk_scalar (Ghost.reveal v1)))
= let x1 = read r1 in
let x2 = read r2 in
write r1 x2;
write r2 x1;
return () | {
"file_name": "share/steel/examples/steelc/PointStructDirectDef.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 11,
"end_line": 15,
"start_col": 0,
"start_line": 8
} | module PointStructDirectDef
open Steel.ST.Util
open Steel.ST.C.Types
module U32 = FStar.UInt32
// module C = C // for _zero_for_deref | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Util.fsti.checked",
"Steel.ST.C.Types.fst.checked",
"prims.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "PointStructDirectDef.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "Steel.ST.C.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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: Steel.ST.C.Types.Base.ref (Steel.ST.C.Types.Scalar.scalar FStar.UInt32.t) ->
r2: Steel.ST.C.Types.Base.ref (Steel.ST.C.Types.Scalar.scalar FStar.UInt32.t)
-> Steel.ST.Effect.STT Prims.unit | Steel.ST.Effect.STT | [] | [] | [
"FStar.Ghost.erased",
"FStar.UInt32.t",
"Steel.ST.C.Types.Base.ref",
"Steel.ST.C.Types.Scalar.scalar_t",
"Steel.ST.C.Types.Scalar.scalar",
"Steel.ST.Util.return",
"Prims.unit",
"FStar.Ghost.hide",
"FStar.Set.set",
"Steel.Memory.iname",
"FStar.Set.empty",
"Steel.Effect.Common.VStar",
"Steel.ST.C.Types.Base.pts_to",
"Steel.ST.C.Types.Scalar.mk_scalar",
"FStar.Ghost.reveal",
"Steel.Effect.Common.vprop",
"Steel.ST.C.Types.Scalar.write",
"Steel.ST.C.Types.Scalar.read",
"Steel.Effect.Common.star"
] | [] | false | true | false | false | false | let swap (#v1 #v2: Ghost.erased U32.t) (r1 r2: ref (scalar U32.t))
: STT unit
((r1 `pts_to` (mk_scalar (Ghost.reveal v1)))
`star`
(r2 `pts_to` (mk_scalar (Ghost.reveal v2))))
(fun _ ->
(r1 `pts_to` (mk_scalar (Ghost.reveal v2)))
`star`
(r2 `pts_to` (mk_scalar (Ghost.reveal v1)))) =
| let x1 = read r1 in
let x2 = read r2 in
write r1 x2;
write r2 x1;
return () | false |
SfPoly.fst | SfPoly.evenb | val evenb : nat -> Tot bool | val evenb : nat -> Tot bool | let evenb i = i%2 = 0 | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 21,
"end_line": 188,
"start_col": 0,
"start_line": 188
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *)
val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c
let prod_curry f x y = f (x,y)
val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c
let prod_uncurry f xy = f (fst xy) (snd xy)
val test_prod_uncurry: f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_uncurry f) (x, y) == f x y))
let test_prod_uncurry f x y = ()
val test_prod_curry: f:(('a * 'b)->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_curry f) x y == f (x, y)))
let test_prod_curry f x y = ()
val uncurry_curry : f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures (prod_curry (prod_uncurry f) x y == f x y))
let uncurry_curry f x y = ()
val curry_uncurry : f:(('a*'b)->Tot 'c) -> xy:('a*'b) -> Lemma
(ensures (prod_uncurry (prod_curry f) xy == f xy))
let curry_uncurry f xy = ()
(* Filter *)
val filter : test:('a->Tot bool) -> l:(list 'a) -> Tot (list 'a)
let rec filter test l =
match l with
| [] -> []
| h :: t -> if test h then h :: (filter test t)
else filter test t | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | i: Prims.nat -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Prims.op_Equality",
"Prims.int",
"Prims.op_Modulus",
"Prims.bool"
] | [] | false | false | false | true | false | let evenb i =
| i % 2 = 0 | false |
SfPoly.fst | SfPoly.index_option | val index_option : list 'a -> nat -> Tot (option 'a) | val index_option : list 'a -> nat -> Tot (option 'a) | let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1) | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 60,
"end_line": 126,
"start_col": 0,
"start_line": 123
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | l: Prims.list 'a -> n: Prims.nat -> FStar.Pervasives.Native.option 'a | Prims.Tot | [
"total"
] | [] | [
"Prims.list",
"Prims.nat",
"FStar.Pervasives.Native.None",
"Prims.op_Equality",
"Prims.int",
"FStar.Pervasives.Native.Some",
"Prims.bool",
"SfPoly.index_option",
"Prims.op_Subtraction",
"FStar.Pervasives.Native.option"
] | [
"recursion"
] | false | false | false | true | false | let rec index_option l n =
| match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n - 1) | false |
SfPoly.fst | SfPoly.oddb | val oddb : nat -> Tot bool | val oddb : nat -> Tot bool | let oddb n = not (evenb n) | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 26,
"end_line": 199,
"start_col": 0,
"start_line": 199
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *)
val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c
let prod_curry f x y = f (x,y)
val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c
let prod_uncurry f xy = f (fst xy) (snd xy)
val test_prod_uncurry: f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_uncurry f) (x, y) == f x y))
let test_prod_uncurry f x y = ()
val test_prod_curry: f:(('a * 'b)->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_curry f) x y == f (x, y)))
let test_prod_curry f x y = ()
val uncurry_curry : f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures (prod_curry (prod_uncurry f) x y == f x y))
let uncurry_curry f x y = ()
val curry_uncurry : f:(('a*'b)->Tot 'c) -> xy:('a*'b) -> Lemma
(ensures (prod_uncurry (prod_curry f) xy == f xy))
let curry_uncurry f xy = ()
(* Filter *)
val filter : test:('a->Tot bool) -> l:(list 'a) -> Tot (list 'a)
let rec filter test l =
match l with
| [] -> []
| h :: t -> if test h then h :: (filter test t)
else filter test t
val evenb : nat -> Tot bool
let evenb i = i%2 = 0
(* NS: Note: induction over non-inductive types like int is also fine *)
val evenb' : nat -> Tot bool
let rec evenb' i =
match i with
| 0 -> true
| 1 -> false
| _ -> evenb' (i-2) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 | n: Prims.nat -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Prims.op_Negation",
"SfPoly.evenb",
"Prims.bool"
] | [] | false | false | false | true | false | let oddb n =
| not (evenb n) | false |
FStar.Tactics.NamedView.fsti | FStar.Tactics.NamedView.tag_of | val tag_of (t: term) : Tac string | val tag_of (t: term) : Tac string | let tag_of (t:term) : Tac string =
match inspect t with
| Tv_Var bv -> "Tv_Var"
| Tv_BVar fv -> "Tv_BVar"
| Tv_FVar fv -> "Tv_FVar"
| Tv_UInst _ _ -> "Tv_UInst"
| Tv_App f x -> "Tv_App"
| Tv_Abs x t -> "Tv_Abs"
| Tv_Arrow x t -> "Tv_Arrow"
| Tv_Type _ -> "Tv_Type"
| Tv_Refine x t -> "Tv_Refine"
| Tv_Const cst -> "Tv_Const"
| Tv_Uvar i t -> "Tv_Uvar"
| Tv_Let r attrs b t1 t2 -> "Tv_Let"
| Tv_Match t _ branches -> "Tv_Match"
| Tv_AscribedT _ _ _ _ -> "Tv_AscribedT"
| Tv_AscribedC _ _ _ _ -> "Tv_AscribedC"
| Tv_Unknown -> "Tv_Unknown"
| Tv_Unsupp -> "Tv_Unsupp" | {
"file_name": "ulib/FStar.Tactics.NamedView.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 28,
"end_line": 237,
"start_col": 0,
"start_line": 219
} | (*
Copyright 2008-2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Tactics.NamedView
open FStar.Tactics.Effect
open FStar.Reflection.V2
module R = FStar.Reflection.V2
(* Re export the syntax types. Expose variables as their views, users do
not need to pack/inspect these if they are using the named view. *)
type namedv = R.namedv_view
type bv = R.bv_view
type comp = R.comp_view
type binding = R.binding (* already good *)
(* Terms and universes are still *deep*, so we do not change their
representation, and the user needs to pack/inspect. *)
type term = R.term
type universe = R.universe
[@@plugin]
noeq
type binder = {
uniq : nat;
ppname : ppname_t;
sort : R.typ;
qual : aqualv;
attrs : list term;
}
type binders = list binder
let is_simple_binder (b:binder) = Q_Explicit? b.qual /\ Nil? b.attrs
type simple_binder = b:binder{is_simple_binder b}
type univ_name = string & Range.range
[@@plugin]
noeq
type named_universe_view =
| Uv_Zero : named_universe_view
| Uv_Succ : universe -> named_universe_view
| Uv_Max : universes -> named_universe_view
| Uv_BVar : nat -> named_universe_view
| Uv_Name : univ_name -> named_universe_view
| Uv_Unif : R.universe_uvar -> named_universe_view
| Uv_Unk : named_universe_view
[@@plugin]
noeq
type pattern =
// A built-in constant
| Pat_Constant {
c : vconst
}
// A fully applied constructor, each boolean marks whether the
// argument was an explicitly-provided implicit argument
| Pat_Cons {
head : fv;
univs : option universes;
subpats : list (pattern * bool)
}
// A pattern-bound *named* variable.
| Pat_Var {
v : namedv;
sort : sealed typ;
}
// Dot pattern: resolved by other elements in the pattern and type
| Pat_Dot_Term {
t : option term;
}
type branch = pattern & term
type match_returns_ascription = binder & (either term comp & option term & bool)
[@@plugin]
noeq
type named_term_view =
| Tv_Var : v:namedv -> named_term_view
| Tv_BVar : v:bv -> named_term_view
| Tv_FVar : v:fv -> named_term_view
| Tv_UInst : v:fv -> us:universes -> named_term_view
| Tv_App : hd:term -> a:argv -> named_term_view
| Tv_Abs : b:binder -> body:term -> named_term_view
| Tv_Arrow : b:binder -> c:comp -> named_term_view
| Tv_Type : universe -> named_term_view
| Tv_Refine : b:simple_binder -> ref:term -> named_term_view
| Tv_Const : vconst -> named_term_view
| Tv_Uvar : nat -> ctx_uvar_and_subst -> named_term_view
| Tv_Let : recf:bool -> attrs:(list term) -> b:simple_binder -> def:term -> body:term -> named_term_view
| Tv_Match : scrutinee:term -> ret:option match_returns_ascription -> brs:(list branch) -> named_term_view
| Tv_AscribedT : e:term -> t:term -> tac:option term -> use_eq:bool -> named_term_view
| Tv_AscribedC : e:term -> c:comp -> tac:option term -> use_eq:bool -> named_term_view
| Tv_Unknown : named_term_view // An underscore: _
| Tv_Unsupp : named_term_view // failed to inspect, not supported
// Repeat from FStar.R.Data
let notAscription (tv:named_term_view) : bool =
not (Tv_AscribedT? tv) && not (Tv_AscribedC? tv)
[@@plugin]
noeq
type letbinding = {
lb_fv : fv;
lb_us : list univ_name; (* opened *)
lb_typ : typ;
lb_def : term;
}
[@@plugin]
noeq
type named_sigelt_view =
| Sg_Let {
isrec : bool;
lbs : list letbinding;
}
// Sg_Inductive basically coalesces the Sig_bundle used internally,
// where the type definition and its constructors are split.
// While that might be better for typechecking, this is probably better for metaprogrammers
// (no mutually defined types for now)
| Sg_Inductive {
nm : name; // name of the inductive type being defined
univs : list univ_name; // named universe variables
params : binders; // parameters
typ : typ; // the type annotation for the inductive, i.e., indices -> Type #u
ctors : list ctor; // the constructors, opened with univs and applied to params already
}
| Sg_Val {
nm : name;
univs : list univ_name;
typ : typ;
}
| Unk
(* Some helpers. The latter two are not marked coercions as they make a
choice to not add qualifiers/attrs, so we let the user call them. *)
[@@coercion]
let binder_to_binding (b : binder) : binding =
{
ppname = b.ppname;
uniq = b.uniq;
sort = b.sort;
}
let binding_to_binder (bnd : binding) : binder =
{
ppname = bnd.ppname;
uniq = bnd.uniq;
sort = bnd.sort;
qual = Q_Explicit;
attrs = []
}
let namedv_to_binder (v : namedv) (sort : term) : binder =
{
uniq = v.uniq;
sort = sort;
ppname = v.ppname;
qual = Q_Explicit;
attrs = [];
}
[@@plugin; coercion]
val inspect_universe (u:universe) : Tot named_universe_view
[@@plugin; coercion]
val pack_universe (uv:named_universe_view) : Tot universe
[@@plugin]
val close_term (b:binder) (t:term) : Tot (R.binder & term)
[@@plugin; coercion]
val inspect (t:term) : Tac named_term_view
[@@plugin; coercion]
val pack (tv:named_term_view) : Tot term
[@@plugin; coercion]
val inspect_sigelt (s : sigelt) : Tac named_sigelt_view
[@@plugin; coercion]
val pack_sigelt (sv:named_sigelt_view{~(Unk? sv)}) : Tac sigelt
(* Some primitives mention `R.comp`, wrap them to use `ThisModule.comp = R.comp_view` *)
[@@plugin]
val tcc (e:env) (t:term) : Tac comp
[@@plugin]
val comp_to_string (c:comp) : Tac string
(* Clients of this module use the named view. *)
let universe_view = named_universe_view
let term_view = named_term_view
let sigelt_view = named_sigelt_view
(* Temporary adapters, to avoid breaking existing code too much. *)
let inspect_namedv = id #namedv
let pack_namedv = id #namedv
let inspect_bv = id #bv
let pack_bv = id #bv
let inspect_comp = id #comp
let pack_comp = id #comp | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Range.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.NamedView.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac Prims.string | FStar.Tactics.Effect.Tac | [] | [] | [
"FStar.Tactics.NamedView.term",
"FStar.Tactics.NamedView.namedv",
"FStar.Tactics.NamedView.bv",
"FStar.Stubs.Reflection.Types.fv",
"FStar.Stubs.Reflection.V2.Data.universes",
"FStar.Stubs.Reflection.V2.Data.argv",
"FStar.Tactics.NamedView.binder",
"FStar.Tactics.NamedView.comp",
"FStar.Tactics.NamedView.universe",
"FStar.Tactics.NamedView.simple_binder",
"FStar.Stubs.Reflection.V2.Data.vconst",
"Prims.nat",
"FStar.Stubs.Reflection.Types.ctx_uvar_and_subst",
"Prims.bool",
"Prims.list",
"FStar.Pervasives.Native.option",
"FStar.Tactics.NamedView.match_returns_ascription",
"FStar.Tactics.NamedView.branch",
"Prims.string",
"FStar.Tactics.NamedView.named_term_view",
"FStar.Tactics.NamedView.inspect"
] | [] | false | true | false | false | false | let tag_of (t: term) : Tac string =
| match inspect t with
| Tv_Var bv -> "Tv_Var"
| Tv_BVar fv -> "Tv_BVar"
| Tv_FVar fv -> "Tv_FVar"
| Tv_UInst _ _ -> "Tv_UInst"
| Tv_App f x -> "Tv_App"
| Tv_Abs x t -> "Tv_Abs"
| Tv_Arrow x t -> "Tv_Arrow"
| Tv_Type _ -> "Tv_Type"
| Tv_Refine x t -> "Tv_Refine"
| Tv_Const cst -> "Tv_Const"
| Tv_Uvar i t -> "Tv_Uvar"
| Tv_Let r attrs b t1 t2 -> "Tv_Let"
| Tv_Match t _ branches -> "Tv_Match"
| Tv_AscribedT _ _ _ _ -> "Tv_AscribedT"
| Tv_AscribedC _ _ _ _ -> "Tv_AscribedC"
| Tv_Unknown -> "Tv_Unknown"
| Tv_Unsupp -> "Tv_Unsupp" | false |
Test.Vectors.Poly1305.fst | Test.Vectors.Poly1305.input25 | val input25:(b: B.buffer UInt8.t {B.length b = 415 /\ B.recallable b}) | val input25:(b: B.buffer UInt8.t {B.length b = 415 /\ B.recallable b}) | let input25: (b: B.buffer UInt8.t { B.length b = 415 /\ B.recallable b }) =
[@inline_let] let l = [ 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7auy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x5cuy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x6euy; 0x7buy; 0x00uy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7auy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x5cuy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x6euy; 0x7buy; 0x00uy; 0x13uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0xb3uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0xf2uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x20uy; 0x00uy; 0xefuy; 0xffuy; 0x00uy; 0x09uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x10uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x09uy; 0x00uy; 0x00uy; 0x00uy; 0x64uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x13uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0xb3uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0xf2uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x20uy; 0x00uy; 0xefuy; 0xffuy; 0x00uy; 0x09uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x7auy; 0x00uy; 0x00uy; 0x10uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x09uy; 0x00uy; 0x00uy; 0x00uy; 0x64uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0xfcuy; ] in
assert_norm (List.Tot.length l = 415);
B.gcmalloc_of_list HyperStack.root l | {
"file_name": "providers/test/vectors/Test.Vectors.Poly1305.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 38,
"end_line": 610,
"start_col": 0,
"start_line": 607
} | module Test.Vectors.Poly1305
module B = LowStar.Buffer
#set-options "--max_fuel 0 --max_ifuel 0"
let input0: (b: B.buffer UInt8.t { B.length b = 34 /\ B.recallable b }) =
[@inline_let] let l = [ 0x43uy; 0x72uy; 0x79uy; 0x70uy; 0x74uy; 0x6fuy; 0x67uy; 0x72uy; 0x61uy; 0x70uy; 0x68uy; 0x69uy; 0x63uy; 0x20uy; 0x46uy; 0x6fuy; 0x72uy; 0x75uy; 0x6duy; 0x20uy; 0x52uy; 0x65uy; 0x73uy; 0x65uy; 0x61uy; 0x72uy; 0x63uy; 0x68uy; 0x20uy; 0x47uy; 0x72uy; 0x6fuy; 0x75uy; 0x70uy; ] in
assert_norm (List.Tot.length l = 34);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input0_len: (x:UInt32.t { UInt32.v x = B.length input0 }) =
34ul
let key0: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x85uy; 0xd6uy; 0xbeuy; 0x78uy; 0x57uy; 0x55uy; 0x6duy; 0x33uy; 0x7fuy; 0x44uy; 0x52uy; 0xfeuy; 0x42uy; 0xd5uy; 0x06uy; 0xa8uy; 0x01uy; 0x03uy; 0x80uy; 0x8auy; 0xfbuy; 0x0duy; 0xb2uy; 0xfduy; 0x4auy; 0xbfuy; 0xf6uy; 0xafuy; 0x41uy; 0x49uy; 0xf5uy; 0x1buy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key0_len: (x:UInt32.t { UInt32.v x = B.length key0 }) =
32ul
let tag0: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0xa8uy; 0x06uy; 0x1duy; 0xc1uy; 0x30uy; 0x51uy; 0x36uy; 0xc6uy; 0xc2uy; 0x2buy; 0x8buy; 0xafuy; 0x0cuy; 0x01uy; 0x27uy; 0xa9uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag0_len: (x:UInt32.t { UInt32.v x = B.length tag0 }) =
16ul
let input1: (b: B.buffer UInt8.t { B.length b = 2 /\ B.recallable b }) =
[@inline_let] let l = [ 0xf3uy; 0xf6uy; ] in
assert_norm (List.Tot.length l = 2);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input1_len: (x:UInt32.t { UInt32.v x = B.length input1 }) =
2ul
let key1: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x85uy; 0x1fuy; 0xc4uy; 0x0cuy; 0x34uy; 0x67uy; 0xacuy; 0x0buy; 0xe0uy; 0x5cuy; 0xc2uy; 0x04uy; 0x04uy; 0xf3uy; 0xf7uy; 0x00uy; 0x58uy; 0x0buy; 0x3buy; 0x0fuy; 0x94uy; 0x47uy; 0xbbuy; 0x1euy; 0x69uy; 0xd0uy; 0x95uy; 0xb5uy; 0x92uy; 0x8buy; 0x6duy; 0xbcuy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key1_len: (x:UInt32.t { UInt32.v x = B.length key1 }) =
32ul
let tag1: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0xf4uy; 0xc6uy; 0x33uy; 0xc3uy; 0x04uy; 0x4fuy; 0xc1uy; 0x45uy; 0xf8uy; 0x4fuy; 0x33uy; 0x5cuy; 0xb8uy; 0x19uy; 0x53uy; 0xdeuy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag1_len: (x:UInt32.t { UInt32.v x = B.length tag1 }) =
16ul
let input2: (b: B.buffer UInt8.t { B.length b = 0 /\ B.recallable b }) =
[@inline_let] let l = [ ] in
assert_norm (List.Tot.length l = 0);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input2_len: (x:UInt32.t { UInt32.v x = B.length input2 }) =
0ul
let key2: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0xa0uy; 0xf3uy; 0x08uy; 0x00uy; 0x00uy; 0xf4uy; 0x64uy; 0x00uy; 0xd0uy; 0xc7uy; 0xe9uy; 0x07uy; 0x6cuy; 0x83uy; 0x44uy; 0x03uy; 0xdduy; 0x3fuy; 0xabuy; 0x22uy; 0x51uy; 0xf1uy; 0x1auy; 0xc7uy; 0x59uy; 0xf0uy; 0x88uy; 0x71uy; 0x29uy; 0xccuy; 0x2euy; 0xe7uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key2_len: (x:UInt32.t { UInt32.v x = B.length key2 }) =
32ul
let tag2: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0xdduy; 0x3fuy; 0xabuy; 0x22uy; 0x51uy; 0xf1uy; 0x1auy; 0xc7uy; 0x59uy; 0xf0uy; 0x88uy; 0x71uy; 0x29uy; 0xccuy; 0x2euy; 0xe7uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag2_len: (x:UInt32.t { UInt32.v x = B.length tag2 }) =
16ul
let input3: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x66uy; 0x3cuy; 0xeauy; 0x19uy; 0x0fuy; 0xfbuy; 0x83uy; 0xd8uy; 0x95uy; 0x93uy; 0xf3uy; 0xf4uy; 0x76uy; 0xb6uy; 0xbcuy; 0x24uy; 0xd7uy; 0xe6uy; 0x79uy; 0x10uy; 0x7euy; 0xa2uy; 0x6auy; 0xdbuy; 0x8cuy; 0xafuy; 0x66uy; 0x52uy; 0xd0uy; 0x65uy; 0x61uy; 0x36uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input3_len: (x:UInt32.t { UInt32.v x = B.length input3 }) =
32ul
let key3: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x48uy; 0x44uy; 0x3duy; 0x0buy; 0xb0uy; 0xd2uy; 0x11uy; 0x09uy; 0xc8uy; 0x9auy; 0x10uy; 0x0buy; 0x5cuy; 0xe2uy; 0xc2uy; 0x08uy; 0x83uy; 0x14uy; 0x9cuy; 0x69uy; 0xb5uy; 0x61uy; 0xdduy; 0x88uy; 0x29uy; 0x8auy; 0x17uy; 0x98uy; 0xb1uy; 0x07uy; 0x16uy; 0xefuy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key3_len: (x:UInt32.t { UInt32.v x = B.length key3 }) =
32ul
let tag3: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0x0euy; 0xe1uy; 0xc1uy; 0x6buy; 0xb7uy; 0x3fuy; 0x0fuy; 0x4fuy; 0xd1uy; 0x98uy; 0x81uy; 0x75uy; 0x3cuy; 0x01uy; 0xcduy; 0xbeuy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag3_len: (x:UInt32.t { UInt32.v x = B.length tag3 }) =
16ul
let input4: (b: B.buffer UInt8.t { B.length b = 63 /\ B.recallable b }) =
[@inline_let] let l = [ 0xabuy; 0x08uy; 0x12uy; 0x72uy; 0x4auy; 0x7fuy; 0x1euy; 0x34uy; 0x27uy; 0x42uy; 0xcbuy; 0xeduy; 0x37uy; 0x4duy; 0x94uy; 0xd1uy; 0x36uy; 0xc6uy; 0xb8uy; 0x79uy; 0x5duy; 0x45uy; 0xb3uy; 0x81uy; 0x98uy; 0x30uy; 0xf2uy; 0xc0uy; 0x44uy; 0x91uy; 0xfauy; 0xf0uy; 0x99uy; 0x0cuy; 0x62uy; 0xe4uy; 0x8buy; 0x80uy; 0x18uy; 0xb2uy; 0xc3uy; 0xe4uy; 0xa0uy; 0xfauy; 0x31uy; 0x34uy; 0xcbuy; 0x67uy; 0xfauy; 0x83uy; 0xe1uy; 0x58uy; 0xc9uy; 0x94uy; 0xd9uy; 0x61uy; 0xc4uy; 0xcbuy; 0x21uy; 0x09uy; 0x5cuy; 0x1buy; 0xf9uy; ] in
assert_norm (List.Tot.length l = 63);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input4_len: (x:UInt32.t { UInt32.v x = B.length input4 }) =
63ul
let key4: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x12uy; 0x97uy; 0x6auy; 0x08uy; 0xc4uy; 0x42uy; 0x6duy; 0x0cuy; 0xe8uy; 0xa8uy; 0x24uy; 0x07uy; 0xc4uy; 0xf4uy; 0x82uy; 0x07uy; 0x80uy; 0xf8uy; 0xc2uy; 0x0auy; 0xa7uy; 0x12uy; 0x02uy; 0xd1uy; 0xe2uy; 0x91uy; 0x79uy; 0xcbuy; 0xcbuy; 0x55uy; 0x5auy; 0x57uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key4_len: (x:UInt32.t { UInt32.v x = B.length key4 }) =
32ul
let tag4: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0x51uy; 0x54uy; 0xaduy; 0x0duy; 0x2cuy; 0xb2uy; 0x6euy; 0x01uy; 0x27uy; 0x4fuy; 0xc5uy; 0x11uy; 0x48uy; 0x49uy; 0x1fuy; 0x1buy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag4_len: (x:UInt32.t { UInt32.v x = B.length tag4 }) =
16ul
let input5: (b: B.buffer UInt8.t { B.length b = 64 /\ B.recallable b }) =
[@inline_let] let l = [ 0xabuy; 0x08uy; 0x12uy; 0x72uy; 0x4auy; 0x7fuy; 0x1euy; 0x34uy; 0x27uy; 0x42uy; 0xcbuy; 0xeduy; 0x37uy; 0x4duy; 0x94uy; 0xd1uy; 0x36uy; 0xc6uy; 0xb8uy; 0x79uy; 0x5duy; 0x45uy; 0xb3uy; 0x81uy; 0x98uy; 0x30uy; 0xf2uy; 0xc0uy; 0x44uy; 0x91uy; 0xfauy; 0xf0uy; 0x99uy; 0x0cuy; 0x62uy; 0xe4uy; 0x8buy; 0x80uy; 0x18uy; 0xb2uy; 0xc3uy; 0xe4uy; 0xa0uy; 0xfauy; 0x31uy; 0x34uy; 0xcbuy; 0x67uy; 0xfauy; 0x83uy; 0xe1uy; 0x58uy; 0xc9uy; 0x94uy; 0xd9uy; 0x61uy; 0xc4uy; 0xcbuy; 0x21uy; 0x09uy; 0x5cuy; 0x1buy; 0xf9uy; 0xafuy; ] in
assert_norm (List.Tot.length l = 64);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input5_len: (x:UInt32.t { UInt32.v x = B.length input5 }) =
64ul
let key5: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x12uy; 0x97uy; 0x6auy; 0x08uy; 0xc4uy; 0x42uy; 0x6duy; 0x0cuy; 0xe8uy; 0xa8uy; 0x24uy; 0x07uy; 0xc4uy; 0xf4uy; 0x82uy; 0x07uy; 0x80uy; 0xf8uy; 0xc2uy; 0x0auy; 0xa7uy; 0x12uy; 0x02uy; 0xd1uy; 0xe2uy; 0x91uy; 0x79uy; 0xcbuy; 0xcbuy; 0x55uy; 0x5auy; 0x57uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key5_len: (x:UInt32.t { UInt32.v x = B.length key5 }) =
32ul
let tag5: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0x81uy; 0x20uy; 0x59uy; 0xa5uy; 0xdauy; 0x19uy; 0x86uy; 0x37uy; 0xcauy; 0xc7uy; 0xc4uy; 0xa6uy; 0x31uy; 0xbeuy; 0xe4uy; 0x66uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag5_len: (x:UInt32.t { UInt32.v x = B.length tag5 }) =
16ul
let input6: (b: B.buffer UInt8.t { B.length b = 48 /\ B.recallable b }) =
[@inline_let] let l = [ 0xabuy; 0x08uy; 0x12uy; 0x72uy; 0x4auy; 0x7fuy; 0x1euy; 0x34uy; 0x27uy; 0x42uy; 0xcbuy; 0xeduy; 0x37uy; 0x4duy; 0x94uy; 0xd1uy; 0x36uy; 0xc6uy; 0xb8uy; 0x79uy; 0x5duy; 0x45uy; 0xb3uy; 0x81uy; 0x98uy; 0x30uy; 0xf2uy; 0xc0uy; 0x44uy; 0x91uy; 0xfauy; 0xf0uy; 0x99uy; 0x0cuy; 0x62uy; 0xe4uy; 0x8buy; 0x80uy; 0x18uy; 0xb2uy; 0xc3uy; 0xe4uy; 0xa0uy; 0xfauy; 0x31uy; 0x34uy; 0xcbuy; 0x67uy; ] in
assert_norm (List.Tot.length l = 48);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input6_len: (x:UInt32.t { UInt32.v x = B.length input6 }) =
48ul
let key6: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x12uy; 0x97uy; 0x6auy; 0x08uy; 0xc4uy; 0x42uy; 0x6duy; 0x0cuy; 0xe8uy; 0xa8uy; 0x24uy; 0x07uy; 0xc4uy; 0xf4uy; 0x82uy; 0x07uy; 0x80uy; 0xf8uy; 0xc2uy; 0x0auy; 0xa7uy; 0x12uy; 0x02uy; 0xd1uy; 0xe2uy; 0x91uy; 0x79uy; 0xcbuy; 0xcbuy; 0x55uy; 0x5auy; 0x57uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key6_len: (x:UInt32.t { UInt32.v x = B.length key6 }) =
32ul
let tag6: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0x5buy; 0x88uy; 0xd7uy; 0xf6uy; 0x22uy; 0x8buy; 0x11uy; 0xe2uy; 0xe2uy; 0x85uy; 0x79uy; 0xa5uy; 0xc0uy; 0xc1uy; 0xf7uy; 0x61uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag6_len: (x:UInt32.t { UInt32.v x = B.length tag6 }) =
16ul
let input7: (b: B.buffer UInt8.t { B.length b = 96 /\ B.recallable b }) =
[@inline_let] let l = [ 0xabuy; 0x08uy; 0x12uy; 0x72uy; 0x4auy; 0x7fuy; 0x1euy; 0x34uy; 0x27uy; 0x42uy; 0xcbuy; 0xeduy; 0x37uy; 0x4duy; 0x94uy; 0xd1uy; 0x36uy; 0xc6uy; 0xb8uy; 0x79uy; 0x5duy; 0x45uy; 0xb3uy; 0x81uy; 0x98uy; 0x30uy; 0xf2uy; 0xc0uy; 0x44uy; 0x91uy; 0xfauy; 0xf0uy; 0x99uy; 0x0cuy; 0x62uy; 0xe4uy; 0x8buy; 0x80uy; 0x18uy; 0xb2uy; 0xc3uy; 0xe4uy; 0xa0uy; 0xfauy; 0x31uy; 0x34uy; 0xcbuy; 0x67uy; 0xfauy; 0x83uy; 0xe1uy; 0x58uy; 0xc9uy; 0x94uy; 0xd9uy; 0x61uy; 0xc4uy; 0xcbuy; 0x21uy; 0x09uy; 0x5cuy; 0x1buy; 0xf9uy; 0xafuy; 0x66uy; 0x3cuy; 0xeauy; 0x19uy; 0x0fuy; 0xfbuy; 0x83uy; 0xd8uy; 0x95uy; 0x93uy; 0xf3uy; 0xf4uy; 0x76uy; 0xb6uy; 0xbcuy; 0x24uy; 0xd7uy; 0xe6uy; 0x79uy; 0x10uy; 0x7euy; 0xa2uy; 0x6auy; 0xdbuy; 0x8cuy; 0xafuy; 0x66uy; 0x52uy; 0xd0uy; 0x65uy; 0x61uy; 0x36uy; ] in
assert_norm (List.Tot.length l = 96);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input7_len: (x:UInt32.t { UInt32.v x = B.length input7 }) =
96ul
let key7: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x12uy; 0x97uy; 0x6auy; 0x08uy; 0xc4uy; 0x42uy; 0x6duy; 0x0cuy; 0xe8uy; 0xa8uy; 0x24uy; 0x07uy; 0xc4uy; 0xf4uy; 0x82uy; 0x07uy; 0x80uy; 0xf8uy; 0xc2uy; 0x0auy; 0xa7uy; 0x12uy; 0x02uy; 0xd1uy; 0xe2uy; 0x91uy; 0x79uy; 0xcbuy; 0xcbuy; 0x55uy; 0x5auy; 0x57uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key7_len: (x:UInt32.t { UInt32.v x = B.length key7 }) =
32ul
let tag7: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0xbbuy; 0xb6uy; 0x13uy; 0xb2uy; 0xb6uy; 0xd7uy; 0x53uy; 0xbauy; 0x07uy; 0x39uy; 0x5buy; 0x91uy; 0x6auy; 0xaeuy; 0xceuy; 0x15uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag7_len: (x:UInt32.t { UInt32.v x = B.length tag7 }) =
16ul
let input8: (b: B.buffer UInt8.t { B.length b = 112 /\ B.recallable b }) =
[@inline_let] let l = [ 0xabuy; 0x08uy; 0x12uy; 0x72uy; 0x4auy; 0x7fuy; 0x1euy; 0x34uy; 0x27uy; 0x42uy; 0xcbuy; 0xeduy; 0x37uy; 0x4duy; 0x94uy; 0xd1uy; 0x36uy; 0xc6uy; 0xb8uy; 0x79uy; 0x5duy; 0x45uy; 0xb3uy; 0x81uy; 0x98uy; 0x30uy; 0xf2uy; 0xc0uy; 0x44uy; 0x91uy; 0xfauy; 0xf0uy; 0x99uy; 0x0cuy; 0x62uy; 0xe4uy; 0x8buy; 0x80uy; 0x18uy; 0xb2uy; 0xc3uy; 0xe4uy; 0xa0uy; 0xfauy; 0x31uy; 0x34uy; 0xcbuy; 0x67uy; 0xfauy; 0x83uy; 0xe1uy; 0x58uy; 0xc9uy; 0x94uy; 0xd9uy; 0x61uy; 0xc4uy; 0xcbuy; 0x21uy; 0x09uy; 0x5cuy; 0x1buy; 0xf9uy; 0xafuy; 0x48uy; 0x44uy; 0x3duy; 0x0buy; 0xb0uy; 0xd2uy; 0x11uy; 0x09uy; 0xc8uy; 0x9auy; 0x10uy; 0x0buy; 0x5cuy; 0xe2uy; 0xc2uy; 0x08uy; 0x83uy; 0x14uy; 0x9cuy; 0x69uy; 0xb5uy; 0x61uy; 0xdduy; 0x88uy; 0x29uy; 0x8auy; 0x17uy; 0x98uy; 0xb1uy; 0x07uy; 0x16uy; 0xefuy; 0x66uy; 0x3cuy; 0xeauy; 0x19uy; 0x0fuy; 0xfbuy; 0x83uy; 0xd8uy; 0x95uy; 0x93uy; 0xf3uy; 0xf4uy; 0x76uy; 0xb6uy; 0xbcuy; 0x24uy; ] in
assert_norm (List.Tot.length l = 112);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input8_len: (x:UInt32.t { UInt32.v x = B.length input8 }) =
112ul
let key8: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x12uy; 0x97uy; 0x6auy; 0x08uy; 0xc4uy; 0x42uy; 0x6duy; 0x0cuy; 0xe8uy; 0xa8uy; 0x24uy; 0x07uy; 0xc4uy; 0xf4uy; 0x82uy; 0x07uy; 0x80uy; 0xf8uy; 0xc2uy; 0x0auy; 0xa7uy; 0x12uy; 0x02uy; 0xd1uy; 0xe2uy; 0x91uy; 0x79uy; 0xcbuy; 0xcbuy; 0x55uy; 0x5auy; 0x57uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key8_len: (x:UInt32.t { UInt32.v x = B.length key8 }) =
32ul
let tag8: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0xc7uy; 0x94uy; 0xd7uy; 0x05uy; 0x7duy; 0x17uy; 0x78uy; 0xc4uy; 0xbbuy; 0xeeuy; 0x0auy; 0x39uy; 0xb3uy; 0xd9uy; 0x73uy; 0x42uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag8_len: (x:UInt32.t { UInt32.v x = B.length tag8 }) =
16ul
let input9: (b: B.buffer UInt8.t { B.length b = 128 /\ B.recallable b }) =
[@inline_let] let l = [ 0xabuy; 0x08uy; 0x12uy; 0x72uy; 0x4auy; 0x7fuy; 0x1euy; 0x34uy; 0x27uy; 0x42uy; 0xcbuy; 0xeduy; 0x37uy; 0x4duy; 0x94uy; 0xd1uy; 0x36uy; 0xc6uy; 0xb8uy; 0x79uy; 0x5duy; 0x45uy; 0xb3uy; 0x81uy; 0x98uy; 0x30uy; 0xf2uy; 0xc0uy; 0x44uy; 0x91uy; 0xfauy; 0xf0uy; 0x99uy; 0x0cuy; 0x62uy; 0xe4uy; 0x8buy; 0x80uy; 0x18uy; 0xb2uy; 0xc3uy; 0xe4uy; 0xa0uy; 0xfauy; 0x31uy; 0x34uy; 0xcbuy; 0x67uy; 0xfauy; 0x83uy; 0xe1uy; 0x58uy; 0xc9uy; 0x94uy; 0xd9uy; 0x61uy; 0xc4uy; 0xcbuy; 0x21uy; 0x09uy; 0x5cuy; 0x1buy; 0xf9uy; 0xafuy; 0x48uy; 0x44uy; 0x3duy; 0x0buy; 0xb0uy; 0xd2uy; 0x11uy; 0x09uy; 0xc8uy; 0x9auy; 0x10uy; 0x0buy; 0x5cuy; 0xe2uy; 0xc2uy; 0x08uy; 0x83uy; 0x14uy; 0x9cuy; 0x69uy; 0xb5uy; 0x61uy; 0xdduy; 0x88uy; 0x29uy; 0x8auy; 0x17uy; 0x98uy; 0xb1uy; 0x07uy; 0x16uy; 0xefuy; 0x66uy; 0x3cuy; 0xeauy; 0x19uy; 0x0fuy; 0xfbuy; 0x83uy; 0xd8uy; 0x95uy; 0x93uy; 0xf3uy; 0xf4uy; 0x76uy; 0xb6uy; 0xbcuy; 0x24uy; 0xd7uy; 0xe6uy; 0x79uy; 0x10uy; 0x7euy; 0xa2uy; 0x6auy; 0xdbuy; 0x8cuy; 0xafuy; 0x66uy; 0x52uy; 0xd0uy; 0x65uy; 0x61uy; 0x36uy; ] in
assert_norm (List.Tot.length l = 128);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input9_len: (x:UInt32.t { UInt32.v x = B.length input9 }) =
128ul
let key9: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x12uy; 0x97uy; 0x6auy; 0x08uy; 0xc4uy; 0x42uy; 0x6duy; 0x0cuy; 0xe8uy; 0xa8uy; 0x24uy; 0x07uy; 0xc4uy; 0xf4uy; 0x82uy; 0x07uy; 0x80uy; 0xf8uy; 0xc2uy; 0x0auy; 0xa7uy; 0x12uy; 0x02uy; 0xd1uy; 0xe2uy; 0x91uy; 0x79uy; 0xcbuy; 0xcbuy; 0x55uy; 0x5auy; 0x57uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key9_len: (x:UInt32.t { UInt32.v x = B.length key9 }) =
32ul
let tag9: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0xffuy; 0xbcuy; 0xb9uy; 0xb3uy; 0x71uy; 0x42uy; 0x31uy; 0x52uy; 0xd7uy; 0xfcuy; 0xa5uy; 0xaduy; 0x04uy; 0x2fuy; 0xbauy; 0xa9uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag9_len: (x:UInt32.t { UInt32.v x = B.length tag9 }) =
16ul
let input10: (b: B.buffer UInt8.t { B.length b = 144 /\ B.recallable b }) =
[@inline_let] let l = [ 0xabuy; 0x08uy; 0x12uy; 0x72uy; 0x4auy; 0x7fuy; 0x1euy; 0x34uy; 0x27uy; 0x42uy; 0xcbuy; 0xeduy; 0x37uy; 0x4duy; 0x94uy; 0xd1uy; 0x36uy; 0xc6uy; 0xb8uy; 0x79uy; 0x5duy; 0x45uy; 0xb3uy; 0x81uy; 0x98uy; 0x30uy; 0xf2uy; 0xc0uy; 0x44uy; 0x91uy; 0xfauy; 0xf0uy; 0x99uy; 0x0cuy; 0x62uy; 0xe4uy; 0x8buy; 0x80uy; 0x18uy; 0xb2uy; 0xc3uy; 0xe4uy; 0xa0uy; 0xfauy; 0x31uy; 0x34uy; 0xcbuy; 0x67uy; 0xfauy; 0x83uy; 0xe1uy; 0x58uy; 0xc9uy; 0x94uy; 0xd9uy; 0x61uy; 0xc4uy; 0xcbuy; 0x21uy; 0x09uy; 0x5cuy; 0x1buy; 0xf9uy; 0xafuy; 0x48uy; 0x44uy; 0x3duy; 0x0buy; 0xb0uy; 0xd2uy; 0x11uy; 0x09uy; 0xc8uy; 0x9auy; 0x10uy; 0x0buy; 0x5cuy; 0xe2uy; 0xc2uy; 0x08uy; 0x83uy; 0x14uy; 0x9cuy; 0x69uy; 0xb5uy; 0x61uy; 0xdduy; 0x88uy; 0x29uy; 0x8auy; 0x17uy; 0x98uy; 0xb1uy; 0x07uy; 0x16uy; 0xefuy; 0x66uy; 0x3cuy; 0xeauy; 0x19uy; 0x0fuy; 0xfbuy; 0x83uy; 0xd8uy; 0x95uy; 0x93uy; 0xf3uy; 0xf4uy; 0x76uy; 0xb6uy; 0xbcuy; 0x24uy; 0xd7uy; 0xe6uy; 0x79uy; 0x10uy; 0x7euy; 0xa2uy; 0x6auy; 0xdbuy; 0x8cuy; 0xafuy; 0x66uy; 0x52uy; 0xd0uy; 0x65uy; 0x61uy; 0x36uy; 0x81uy; 0x20uy; 0x59uy; 0xa5uy; 0xdauy; 0x19uy; 0x86uy; 0x37uy; 0xcauy; 0xc7uy; 0xc4uy; 0xa6uy; 0x31uy; 0xbeuy; 0xe4uy; 0x66uy; ] in
assert_norm (List.Tot.length l = 144);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input10_len: (x:UInt32.t { UInt32.v x = B.length input10 }) =
144ul
let key10: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x12uy; 0x97uy; 0x6auy; 0x08uy; 0xc4uy; 0x42uy; 0x6duy; 0x0cuy; 0xe8uy; 0xa8uy; 0x24uy; 0x07uy; 0xc4uy; 0xf4uy; 0x82uy; 0x07uy; 0x80uy; 0xf8uy; 0xc2uy; 0x0auy; 0xa7uy; 0x12uy; 0x02uy; 0xd1uy; 0xe2uy; 0x91uy; 0x79uy; 0xcbuy; 0xcbuy; 0x55uy; 0x5auy; 0x57uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key10_len: (x:UInt32.t { UInt32.v x = B.length key10 }) =
32ul
let tag10: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0x06uy; 0x9euy; 0xd6uy; 0xb8uy; 0xefuy; 0x0fuy; 0x20uy; 0x7buy; 0x3euy; 0x24uy; 0x3buy; 0xb1uy; 0x01uy; 0x9fuy; 0xe6uy; 0x32uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag10_len: (x:UInt32.t { UInt32.v x = B.length tag10 }) =
16ul
let input11: (b: B.buffer UInt8.t { B.length b = 160 /\ B.recallable b }) =
[@inline_let] let l = [ 0xabuy; 0x08uy; 0x12uy; 0x72uy; 0x4auy; 0x7fuy; 0x1euy; 0x34uy; 0x27uy; 0x42uy; 0xcbuy; 0xeduy; 0x37uy; 0x4duy; 0x94uy; 0xd1uy; 0x36uy; 0xc6uy; 0xb8uy; 0x79uy; 0x5duy; 0x45uy; 0xb3uy; 0x81uy; 0x98uy; 0x30uy; 0xf2uy; 0xc0uy; 0x44uy; 0x91uy; 0xfauy; 0xf0uy; 0x99uy; 0x0cuy; 0x62uy; 0xe4uy; 0x8buy; 0x80uy; 0x18uy; 0xb2uy; 0xc3uy; 0xe4uy; 0xa0uy; 0xfauy; 0x31uy; 0x34uy; 0xcbuy; 0x67uy; 0xfauy; 0x83uy; 0xe1uy; 0x58uy; 0xc9uy; 0x94uy; 0xd9uy; 0x61uy; 0xc4uy; 0xcbuy; 0x21uy; 0x09uy; 0x5cuy; 0x1buy; 0xf9uy; 0xafuy; 0x48uy; 0x44uy; 0x3duy; 0x0buy; 0xb0uy; 0xd2uy; 0x11uy; 0x09uy; 0xc8uy; 0x9auy; 0x10uy; 0x0buy; 0x5cuy; 0xe2uy; 0xc2uy; 0x08uy; 0x83uy; 0x14uy; 0x9cuy; 0x69uy; 0xb5uy; 0x61uy; 0xdduy; 0x88uy; 0x29uy; 0x8auy; 0x17uy; 0x98uy; 0xb1uy; 0x07uy; 0x16uy; 0xefuy; 0x66uy; 0x3cuy; 0xeauy; 0x19uy; 0x0fuy; 0xfbuy; 0x83uy; 0xd8uy; 0x95uy; 0x93uy; 0xf3uy; 0xf4uy; 0x76uy; 0xb6uy; 0xbcuy; 0x24uy; 0xd7uy; 0xe6uy; 0x79uy; 0x10uy; 0x7euy; 0xa2uy; 0x6auy; 0xdbuy; 0x8cuy; 0xafuy; 0x66uy; 0x52uy; 0xd0uy; 0x65uy; 0x61uy; 0x36uy; 0x81uy; 0x20uy; 0x59uy; 0xa5uy; 0xdauy; 0x19uy; 0x86uy; 0x37uy; 0xcauy; 0xc7uy; 0xc4uy; 0xa6uy; 0x31uy; 0xbeuy; 0xe4uy; 0x66uy; 0x5buy; 0x88uy; 0xd7uy; 0xf6uy; 0x22uy; 0x8buy; 0x11uy; 0xe2uy; 0xe2uy; 0x85uy; 0x79uy; 0xa5uy; 0xc0uy; 0xc1uy; 0xf7uy; 0x61uy; ] in
assert_norm (List.Tot.length l = 160);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input11_len: (x:UInt32.t { UInt32.v x = B.length input11 }) =
160ul
let key11: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x12uy; 0x97uy; 0x6auy; 0x08uy; 0xc4uy; 0x42uy; 0x6duy; 0x0cuy; 0xe8uy; 0xa8uy; 0x24uy; 0x07uy; 0xc4uy; 0xf4uy; 0x82uy; 0x07uy; 0x80uy; 0xf8uy; 0xc2uy; 0x0auy; 0xa7uy; 0x12uy; 0x02uy; 0xd1uy; 0xe2uy; 0x91uy; 0x79uy; 0xcbuy; 0xcbuy; 0x55uy; 0x5auy; 0x57uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key11_len: (x:UInt32.t { UInt32.v x = B.length key11 }) =
32ul
let tag11: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0xccuy; 0xa3uy; 0x39uy; 0xd9uy; 0xa4uy; 0x5fuy; 0xa2uy; 0x36uy; 0x8cuy; 0x2cuy; 0x68uy; 0xb3uy; 0xa4uy; 0x17uy; 0x91uy; 0x33uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag11_len: (x:UInt32.t { UInt32.v x = B.length tag11 }) =
16ul
let input12: (b: B.buffer UInt8.t { B.length b = 288 /\ B.recallable b }) =
[@inline_let] let l = [ 0xabuy; 0x08uy; 0x12uy; 0x72uy; 0x4auy; 0x7fuy; 0x1euy; 0x34uy; 0x27uy; 0x42uy; 0xcbuy; 0xeduy; 0x37uy; 0x4duy; 0x94uy; 0xd1uy; 0x36uy; 0xc6uy; 0xb8uy; 0x79uy; 0x5duy; 0x45uy; 0xb3uy; 0x81uy; 0x98uy; 0x30uy; 0xf2uy; 0xc0uy; 0x44uy; 0x91uy; 0xfauy; 0xf0uy; 0x99uy; 0x0cuy; 0x62uy; 0xe4uy; 0x8buy; 0x80uy; 0x18uy; 0xb2uy; 0xc3uy; 0xe4uy; 0xa0uy; 0xfauy; 0x31uy; 0x34uy; 0xcbuy; 0x67uy; 0xfauy; 0x83uy; 0xe1uy; 0x58uy; 0xc9uy; 0x94uy; 0xd9uy; 0x61uy; 0xc4uy; 0xcbuy; 0x21uy; 0x09uy; 0x5cuy; 0x1buy; 0xf9uy; 0xafuy; 0x48uy; 0x44uy; 0x3duy; 0x0buy; 0xb0uy; 0xd2uy; 0x11uy; 0x09uy; 0xc8uy; 0x9auy; 0x10uy; 0x0buy; 0x5cuy; 0xe2uy; 0xc2uy; 0x08uy; 0x83uy; 0x14uy; 0x9cuy; 0x69uy; 0xb5uy; 0x61uy; 0xdduy; 0x88uy; 0x29uy; 0x8auy; 0x17uy; 0x98uy; 0xb1uy; 0x07uy; 0x16uy; 0xefuy; 0x66uy; 0x3cuy; 0xeauy; 0x19uy; 0x0fuy; 0xfbuy; 0x83uy; 0xd8uy; 0x95uy; 0x93uy; 0xf3uy; 0xf4uy; 0x76uy; 0xb6uy; 0xbcuy; 0x24uy; 0xd7uy; 0xe6uy; 0x79uy; 0x10uy; 0x7euy; 0xa2uy; 0x6auy; 0xdbuy; 0x8cuy; 0xafuy; 0x66uy; 0x52uy; 0xd0uy; 0x65uy; 0x61uy; 0x36uy; 0x81uy; 0x20uy; 0x59uy; 0xa5uy; 0xdauy; 0x19uy; 0x86uy; 0x37uy; 0xcauy; 0xc7uy; 0xc4uy; 0xa6uy; 0x31uy; 0xbeuy; 0xe4uy; 0x66uy; 0x5buy; 0x88uy; 0xd7uy; 0xf6uy; 0x22uy; 0x8buy; 0x11uy; 0xe2uy; 0xe2uy; 0x85uy; 0x79uy; 0xa5uy; 0xc0uy; 0xc1uy; 0xf7uy; 0x61uy; 0xabuy; 0x08uy; 0x12uy; 0x72uy; 0x4auy; 0x7fuy; 0x1euy; 0x34uy; 0x27uy; 0x42uy; 0xcbuy; 0xeduy; 0x37uy; 0x4duy; 0x94uy; 0xd1uy; 0x36uy; 0xc6uy; 0xb8uy; 0x79uy; 0x5duy; 0x45uy; 0xb3uy; 0x81uy; 0x98uy; 0x30uy; 0xf2uy; 0xc0uy; 0x44uy; 0x91uy; 0xfauy; 0xf0uy; 0x99uy; 0x0cuy; 0x62uy; 0xe4uy; 0x8buy; 0x80uy; 0x18uy; 0xb2uy; 0xc3uy; 0xe4uy; 0xa0uy; 0xfauy; 0x31uy; 0x34uy; 0xcbuy; 0x67uy; 0xfauy; 0x83uy; 0xe1uy; 0x58uy; 0xc9uy; 0x94uy; 0xd9uy; 0x61uy; 0xc4uy; 0xcbuy; 0x21uy; 0x09uy; 0x5cuy; 0x1buy; 0xf9uy; 0xafuy; 0x48uy; 0x44uy; 0x3duy; 0x0buy; 0xb0uy; 0xd2uy; 0x11uy; 0x09uy; 0xc8uy; 0x9auy; 0x10uy; 0x0buy; 0x5cuy; 0xe2uy; 0xc2uy; 0x08uy; 0x83uy; 0x14uy; 0x9cuy; 0x69uy; 0xb5uy; 0x61uy; 0xdduy; 0x88uy; 0x29uy; 0x8auy; 0x17uy; 0x98uy; 0xb1uy; 0x07uy; 0x16uy; 0xefuy; 0x66uy; 0x3cuy; 0xeauy; 0x19uy; 0x0fuy; 0xfbuy; 0x83uy; 0xd8uy; 0x95uy; 0x93uy; 0xf3uy; 0xf4uy; 0x76uy; 0xb6uy; 0xbcuy; 0x24uy; 0xd7uy; 0xe6uy; 0x79uy; 0x10uy; 0x7euy; 0xa2uy; 0x6auy; 0xdbuy; 0x8cuy; 0xafuy; 0x66uy; 0x52uy; 0xd0uy; 0x65uy; 0x61uy; 0x36uy; ] in
assert_norm (List.Tot.length l = 288);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input12_len: (x:UInt32.t { UInt32.v x = B.length input12 }) =
288ul
let key12: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x12uy; 0x97uy; 0x6auy; 0x08uy; 0xc4uy; 0x42uy; 0x6duy; 0x0cuy; 0xe8uy; 0xa8uy; 0x24uy; 0x07uy; 0xc4uy; 0xf4uy; 0x82uy; 0x07uy; 0x80uy; 0xf8uy; 0xc2uy; 0x0auy; 0xa7uy; 0x12uy; 0x02uy; 0xd1uy; 0xe2uy; 0x91uy; 0x79uy; 0xcbuy; 0xcbuy; 0x55uy; 0x5auy; 0x57uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key12_len: (x:UInt32.t { UInt32.v x = B.length key12 }) =
32ul
let tag12: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0x53uy; 0xf6uy; 0xe8uy; 0x28uy; 0xa2uy; 0xf0uy; 0xfeuy; 0x0euy; 0xe8uy; 0x15uy; 0xbfuy; 0x0buy; 0xd5uy; 0x84uy; 0x1auy; 0x34uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag12_len: (x:UInt32.t { UInt32.v x = B.length tag12 }) =
16ul
let input13: (b: B.buffer UInt8.t { B.length b = 320 /\ B.recallable b }) =
[@inline_let] let l = [ 0xabuy; 0x08uy; 0x12uy; 0x72uy; 0x4auy; 0x7fuy; 0x1euy; 0x34uy; 0x27uy; 0x42uy; 0xcbuy; 0xeduy; 0x37uy; 0x4duy; 0x94uy; 0xd1uy; 0x36uy; 0xc6uy; 0xb8uy; 0x79uy; 0x5duy; 0x45uy; 0xb3uy; 0x81uy; 0x98uy; 0x30uy; 0xf2uy; 0xc0uy; 0x44uy; 0x91uy; 0xfauy; 0xf0uy; 0x99uy; 0x0cuy; 0x62uy; 0xe4uy; 0x8buy; 0x80uy; 0x18uy; 0xb2uy; 0xc3uy; 0xe4uy; 0xa0uy; 0xfauy; 0x31uy; 0x34uy; 0xcbuy; 0x67uy; 0xfauy; 0x83uy; 0xe1uy; 0x58uy; 0xc9uy; 0x94uy; 0xd9uy; 0x61uy; 0xc4uy; 0xcbuy; 0x21uy; 0x09uy; 0x5cuy; 0x1buy; 0xf9uy; 0xafuy; 0x48uy; 0x44uy; 0x3duy; 0x0buy; 0xb0uy; 0xd2uy; 0x11uy; 0x09uy; 0xc8uy; 0x9auy; 0x10uy; 0x0buy; 0x5cuy; 0xe2uy; 0xc2uy; 0x08uy; 0x83uy; 0x14uy; 0x9cuy; 0x69uy; 0xb5uy; 0x61uy; 0xdduy; 0x88uy; 0x29uy; 0x8auy; 0x17uy; 0x98uy; 0xb1uy; 0x07uy; 0x16uy; 0xefuy; 0x66uy; 0x3cuy; 0xeauy; 0x19uy; 0x0fuy; 0xfbuy; 0x83uy; 0xd8uy; 0x95uy; 0x93uy; 0xf3uy; 0xf4uy; 0x76uy; 0xb6uy; 0xbcuy; 0x24uy; 0xd7uy; 0xe6uy; 0x79uy; 0x10uy; 0x7euy; 0xa2uy; 0x6auy; 0xdbuy; 0x8cuy; 0xafuy; 0x66uy; 0x52uy; 0xd0uy; 0x65uy; 0x61uy; 0x36uy; 0x81uy; 0x20uy; 0x59uy; 0xa5uy; 0xdauy; 0x19uy; 0x86uy; 0x37uy; 0xcauy; 0xc7uy; 0xc4uy; 0xa6uy; 0x31uy; 0xbeuy; 0xe4uy; 0x66uy; 0x5buy; 0x88uy; 0xd7uy; 0xf6uy; 0x22uy; 0x8buy; 0x11uy; 0xe2uy; 0xe2uy; 0x85uy; 0x79uy; 0xa5uy; 0xc0uy; 0xc1uy; 0xf7uy; 0x61uy; 0xabuy; 0x08uy; 0x12uy; 0x72uy; 0x4auy; 0x7fuy; 0x1euy; 0x34uy; 0x27uy; 0x42uy; 0xcbuy; 0xeduy; 0x37uy; 0x4duy; 0x94uy; 0xd1uy; 0x36uy; 0xc6uy; 0xb8uy; 0x79uy; 0x5duy; 0x45uy; 0xb3uy; 0x81uy; 0x98uy; 0x30uy; 0xf2uy; 0xc0uy; 0x44uy; 0x91uy; 0xfauy; 0xf0uy; 0x99uy; 0x0cuy; 0x62uy; 0xe4uy; 0x8buy; 0x80uy; 0x18uy; 0xb2uy; 0xc3uy; 0xe4uy; 0xa0uy; 0xfauy; 0x31uy; 0x34uy; 0xcbuy; 0x67uy; 0xfauy; 0x83uy; 0xe1uy; 0x58uy; 0xc9uy; 0x94uy; 0xd9uy; 0x61uy; 0xc4uy; 0xcbuy; 0x21uy; 0x09uy; 0x5cuy; 0x1buy; 0xf9uy; 0xafuy; 0x48uy; 0x44uy; 0x3duy; 0x0buy; 0xb0uy; 0xd2uy; 0x11uy; 0x09uy; 0xc8uy; 0x9auy; 0x10uy; 0x0buy; 0x5cuy; 0xe2uy; 0xc2uy; 0x08uy; 0x83uy; 0x14uy; 0x9cuy; 0x69uy; 0xb5uy; 0x61uy; 0xdduy; 0x88uy; 0x29uy; 0x8auy; 0x17uy; 0x98uy; 0xb1uy; 0x07uy; 0x16uy; 0xefuy; 0x66uy; 0x3cuy; 0xeauy; 0x19uy; 0x0fuy; 0xfbuy; 0x83uy; 0xd8uy; 0x95uy; 0x93uy; 0xf3uy; 0xf4uy; 0x76uy; 0xb6uy; 0xbcuy; 0x24uy; 0xd7uy; 0xe6uy; 0x79uy; 0x10uy; 0x7euy; 0xa2uy; 0x6auy; 0xdbuy; 0x8cuy; 0xafuy; 0x66uy; 0x52uy; 0xd0uy; 0x65uy; 0x61uy; 0x36uy; 0x81uy; 0x20uy; 0x59uy; 0xa5uy; 0xdauy; 0x19uy; 0x86uy; 0x37uy; 0xcauy; 0xc7uy; 0xc4uy; 0xa6uy; 0x31uy; 0xbeuy; 0xe4uy; 0x66uy; 0x5buy; 0x88uy; 0xd7uy; 0xf6uy; 0x22uy; 0x8buy; 0x11uy; 0xe2uy; 0xe2uy; 0x85uy; 0x79uy; 0xa5uy; 0xc0uy; 0xc1uy; 0xf7uy; 0x61uy; ] in
assert_norm (List.Tot.length l = 320);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input13_len: (x:UInt32.t { UInt32.v x = B.length input13 }) =
320ul
let key13: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x12uy; 0x97uy; 0x6auy; 0x08uy; 0xc4uy; 0x42uy; 0x6duy; 0x0cuy; 0xe8uy; 0xa8uy; 0x24uy; 0x07uy; 0xc4uy; 0xf4uy; 0x82uy; 0x07uy; 0x80uy; 0xf8uy; 0xc2uy; 0x0auy; 0xa7uy; 0x12uy; 0x02uy; 0xd1uy; 0xe2uy; 0x91uy; 0x79uy; 0xcbuy; 0xcbuy; 0x55uy; 0x5auy; 0x57uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key13_len: (x:UInt32.t { UInt32.v x = B.length key13 }) =
32ul
let tag13: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0xb8uy; 0x46uy; 0xd4uy; 0x4euy; 0x9buy; 0xbduy; 0x53uy; 0xceuy; 0xdfuy; 0xfbuy; 0xfbuy; 0xb6uy; 0xb7uy; 0xfauy; 0x49uy; 0x33uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag13_len: (x:UInt32.t { UInt32.v x = B.length tag13 }) =
16ul
let input14: (b: B.buffer UInt8.t { B.length b = 256 /\ B.recallable b }) =
[@inline_let] let l = [ 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; ] in
assert_norm (List.Tot.length l = 256);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input14_len: (x:UInt32.t { UInt32.v x = B.length input14 }) =
256ul
let key14: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0xaduy; 0x62uy; 0x81uy; 0x07uy; 0xe8uy; 0x35uy; 0x1duy; 0x0fuy; 0x2cuy; 0x23uy; 0x1auy; 0x05uy; 0xdcuy; 0x4auy; 0x41uy; 0x06uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key14_len: (x:UInt32.t { UInt32.v x = B.length key14 }) =
32ul
let tag14: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0x07uy; 0x14uy; 0x5auy; 0x4cuy; 0x02uy; 0xfeuy; 0x5fuy; 0xa3uy; 0x20uy; 0x36uy; 0xdeuy; 0x68uy; 0xfauy; 0xbeuy; 0x90uy; 0x66uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag14_len: (x:UInt32.t { UInt32.v x = B.length tag14 }) =
16ul
let input15: (b: B.buffer UInt8.t { B.length b = 252 /\ B.recallable b }) =
[@inline_let] let l = [ 0x84uy; 0x23uy; 0x64uy; 0xe1uy; 0x56uy; 0x33uy; 0x6cuy; 0x09uy; 0x98uy; 0xb9uy; 0x33uy; 0xa6uy; 0x23uy; 0x77uy; 0x26uy; 0x18uy; 0x0duy; 0x9euy; 0x3fuy; 0xdcuy; 0xbduy; 0xe4uy; 0xcduy; 0x5duy; 0x17uy; 0x08uy; 0x0fuy; 0xc3uy; 0xbeuy; 0xb4uy; 0x96uy; 0x14uy; 0xd7uy; 0x12uy; 0x2cuy; 0x03uy; 0x74uy; 0x63uy; 0xffuy; 0x10uy; 0x4duy; 0x73uy; 0xf1uy; 0x9cuy; 0x12uy; 0x70uy; 0x46uy; 0x28uy; 0xd4uy; 0x17uy; 0xc4uy; 0xc5uy; 0x4auy; 0x3fuy; 0xe3uy; 0x0duy; 0x3cuy; 0x3duy; 0x77uy; 0x14uy; 0x38uy; 0x2duy; 0x43uy; 0xb0uy; 0x38uy; 0x2auy; 0x50uy; 0xa5uy; 0xdeuy; 0xe5uy; 0x4buy; 0xe8uy; 0x44uy; 0xb0uy; 0x76uy; 0xe8uy; 0xdfuy; 0x88uy; 0x20uy; 0x1auy; 0x1cuy; 0xd4uy; 0x3buy; 0x90uy; 0xebuy; 0x21uy; 0x64uy; 0x3fuy; 0xa9uy; 0x6fuy; 0x39uy; 0xb5uy; 0x18uy; 0xaauy; 0x83uy; 0x40uy; 0xc9uy; 0x42uy; 0xffuy; 0x3cuy; 0x31uy; 0xbauy; 0xf7uy; 0xc9uy; 0xbduy; 0xbfuy; 0x0fuy; 0x31uy; 0xaeuy; 0x3fuy; 0xa0uy; 0x96uy; 0xbfuy; 0x8cuy; 0x63uy; 0x03uy; 0x06uy; 0x09uy; 0x82uy; 0x9fuy; 0xe7uy; 0x2euy; 0x17uy; 0x98uy; 0x24uy; 0x89uy; 0x0buy; 0xc8uy; 0xe0uy; 0x8cuy; 0x31uy; 0x5cuy; 0x1cuy; 0xceuy; 0x2auy; 0x83uy; 0x14uy; 0x4duy; 0xbbuy; 0xffuy; 0x09uy; 0xf7uy; 0x4euy; 0x3euy; 0xfcuy; 0x77uy; 0x0buy; 0x54uy; 0xd0uy; 0x98uy; 0x4auy; 0x8fuy; 0x19uy; 0xb1uy; 0x47uy; 0x19uy; 0xe6uy; 0x36uy; 0x35uy; 0x64uy; 0x1duy; 0x6buy; 0x1euy; 0xeduy; 0xf6uy; 0x3euy; 0xfbuy; 0xf0uy; 0x80uy; 0xe1uy; 0x78uy; 0x3duy; 0x32uy; 0x44uy; 0x54uy; 0x12uy; 0x11uy; 0x4cuy; 0x20uy; 0xdeuy; 0x0buy; 0x83uy; 0x7auy; 0x0duy; 0xfauy; 0x33uy; 0xd6uy; 0xb8uy; 0x28uy; 0x25uy; 0xffuy; 0xf4uy; 0x4cuy; 0x9auy; 0x70uy; 0xeauy; 0x54uy; 0xceuy; 0x47uy; 0xf0uy; 0x7duy; 0xf6uy; 0x98uy; 0xe6uy; 0xb0uy; 0x33uy; 0x23uy; 0xb5uy; 0x30uy; 0x79uy; 0x36uy; 0x4auy; 0x5fuy; 0xc3uy; 0xe9uy; 0xdduy; 0x03uy; 0x43uy; 0x92uy; 0xbduy; 0xdeuy; 0x86uy; 0xdcuy; 0xcduy; 0xdauy; 0x94uy; 0x32uy; 0x1cuy; 0x5euy; 0x44uy; 0x06uy; 0x04uy; 0x89uy; 0x33uy; 0x6cuy; 0xb6uy; 0x5buy; 0xf3uy; 0x98uy; 0x9cuy; 0x36uy; 0xf7uy; 0x28uy; 0x2cuy; 0x2fuy; 0x5duy; 0x2buy; 0x88uy; 0x2cuy; 0x17uy; 0x1euy; 0x74uy; ] in
assert_norm (List.Tot.length l = 252);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input15_len: (x:UInt32.t { UInt32.v x = B.length input15 }) =
252ul
let key15: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x95uy; 0xd5uy; 0xc0uy; 0x05uy; 0x50uy; 0x3euy; 0x51uy; 0x0duy; 0x8cuy; 0xd0uy; 0xaauy; 0x07uy; 0x2cuy; 0x4auy; 0x4duy; 0x06uy; 0x6euy; 0xabuy; 0xc5uy; 0x2duy; 0x11uy; 0x65uy; 0x3duy; 0xf4uy; 0x7fuy; 0xbfuy; 0x63uy; 0xabuy; 0x19uy; 0x8buy; 0xccuy; 0x26uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key15_len: (x:UInt32.t { UInt32.v x = B.length key15 }) =
32ul
let tag15: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0xf2uy; 0x48uy; 0x31uy; 0x2euy; 0x57uy; 0x8duy; 0x9duy; 0x58uy; 0xf8uy; 0xb7uy; 0xbbuy; 0x4duy; 0x19uy; 0x10uy; 0x54uy; 0x31uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag15_len: (x:UInt32.t { UInt32.v x = B.length tag15 }) =
16ul
let input16: (b: B.buffer UInt8.t { B.length b = 208 /\ B.recallable b }) =
[@inline_let] let l = [ 0x24uy; 0x8auy; 0xc3uy; 0x10uy; 0x85uy; 0xb6uy; 0xc2uy; 0xaduy; 0xaauy; 0xa3uy; 0x82uy; 0x59uy; 0xa0uy; 0xd7uy; 0x19uy; 0x2cuy; 0x5cuy; 0x35uy; 0xd1uy; 0xbbuy; 0x4euy; 0xf3uy; 0x9auy; 0xd9uy; 0x4cuy; 0x38uy; 0xd1uy; 0xc8uy; 0x24uy; 0x79uy; 0xe2uy; 0xdduy; 0x21uy; 0x59uy; 0xa0uy; 0x77uy; 0x02uy; 0x4buy; 0x05uy; 0x89uy; 0xbcuy; 0x8auy; 0x20uy; 0x10uy; 0x1buy; 0x50uy; 0x6fuy; 0x0auy; 0x1auy; 0xd0uy; 0xbbuy; 0xabuy; 0x76uy; 0xe8uy; 0x3auy; 0x83uy; 0xf1uy; 0xb9uy; 0x4buy; 0xe6uy; 0xbeuy; 0xaeuy; 0x74uy; 0xe8uy; 0x74uy; 0xcauy; 0xb6uy; 0x92uy; 0xc5uy; 0x96uy; 0x3auy; 0x75uy; 0x43uy; 0x6buy; 0x77uy; 0x61uy; 0x21uy; 0xecuy; 0x9fuy; 0x62uy; 0x39uy; 0x9auy; 0x3euy; 0x66uy; 0xb2uy; 0xd2uy; 0x27uy; 0x07uy; 0xdauy; 0xe8uy; 0x19uy; 0x33uy; 0xb6uy; 0x27uy; 0x7fuy; 0x3cuy; 0x85uy; 0x16uy; 0xbcuy; 0xbeuy; 0x26uy; 0xdbuy; 0xbduy; 0x86uy; 0xf3uy; 0x73uy; 0x10uy; 0x3duy; 0x7cuy; 0xf4uy; 0xcauy; 0xd1uy; 0x88uy; 0x8cuy; 0x95uy; 0x21uy; 0x18uy; 0xfbuy; 0xfbuy; 0xd0uy; 0xd7uy; 0xb4uy; 0xbeuy; 0xdcuy; 0x4auy; 0xe4uy; 0x93uy; 0x6auy; 0xffuy; 0x91uy; 0x15uy; 0x7euy; 0x7auy; 0xa4uy; 0x7cuy; 0x54uy; 0x44uy; 0x2euy; 0xa7uy; 0x8duy; 0x6auy; 0xc2uy; 0x51uy; 0xd3uy; 0x24uy; 0xa0uy; 0xfbuy; 0xe4uy; 0x9duy; 0x89uy; 0xccuy; 0x35uy; 0x21uy; 0xb6uy; 0x6duy; 0x16uy; 0xe9uy; 0xc6uy; 0x6auy; 0x37uy; 0x09uy; 0x89uy; 0x4euy; 0x4euy; 0xb0uy; 0xa4uy; 0xeeuy; 0xdcuy; 0x4auy; 0xe1uy; 0x94uy; 0x68uy; 0xe6uy; 0x6buy; 0x81uy; 0xf2uy; 0x71uy; 0x35uy; 0x1buy; 0x1duy; 0x92uy; 0x1euy; 0xa5uy; 0x51uy; 0x04uy; 0x7auy; 0xbcuy; 0xc6uy; 0xb8uy; 0x7auy; 0x90uy; 0x1fuy; 0xdeuy; 0x7duy; 0xb7uy; 0x9fuy; 0xa1uy; 0x81uy; 0x8cuy; 0x11uy; 0x33uy; 0x6duy; 0xbcuy; 0x07uy; 0x24uy; 0x4auy; 0x40uy; 0xebuy; ] in
assert_norm (List.Tot.length l = 208);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input16_len: (x:UInt32.t { UInt32.v x = B.length input16 }) =
208ul
let key16: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy; 0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy; 0x0duy; 0x0euy; 0x0fuy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key16_len: (x:UInt32.t { UInt32.v x = B.length key16 }) =
32ul
let tag16: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0xbcuy; 0x93uy; 0x9buy; 0xc5uy; 0x28uy; 0x14uy; 0x80uy; 0xfauy; 0x99uy; 0xc6uy; 0xd6uy; 0x8cuy; 0x25uy; 0x8euy; 0xc4uy; 0x2fuy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag16_len: (x:UInt32.t { UInt32.v x = B.length tag16 }) =
16ul
let input17: (b: B.buffer UInt8.t { B.length b = 0 /\ B.recallable b }) =
[@inline_let] let l = [ ] in
assert_norm (List.Tot.length l = 0);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input17_len: (x:UInt32.t { UInt32.v x = B.length input17 }) =
0ul
let key17: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0xc8uy; 0xafuy; 0xaauy; 0xc3uy; 0x31uy; 0xeeuy; 0x37uy; 0x2cuy; 0xd6uy; 0x08uy; 0x2duy; 0xe1uy; 0x34uy; 0x94uy; 0x3buy; 0x17uy; 0x47uy; 0x10uy; 0x13uy; 0x0euy; 0x9fuy; 0x6fuy; 0xeauy; 0x8duy; 0x72uy; 0x29uy; 0x38uy; 0x50uy; 0xa6uy; 0x67uy; 0xd8uy; 0x6cuy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key17_len: (x:UInt32.t { UInt32.v x = B.length key17 }) =
32ul
let tag17: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0x47uy; 0x10uy; 0x13uy; 0x0euy; 0x9fuy; 0x6fuy; 0xeauy; 0x8duy; 0x72uy; 0x29uy; 0x38uy; 0x50uy; 0xa6uy; 0x67uy; 0xd8uy; 0x6cuy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag17_len: (x:UInt32.t { UInt32.v x = B.length tag17 }) =
16ul
let input18: (b: B.buffer UInt8.t { B.length b = 12 /\ B.recallable b }) =
[@inline_let] let l = [ 0x48uy; 0x65uy; 0x6cuy; 0x6cuy; 0x6fuy; 0x20uy; 0x77uy; 0x6fuy; 0x72uy; 0x6cuy; 0x64uy; 0x21uy; ] in
assert_norm (List.Tot.length l = 12);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input18_len: (x:UInt32.t { UInt32.v x = B.length input18 }) =
12ul
let key18: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x74uy; 0x68uy; 0x69uy; 0x73uy; 0x20uy; 0x69uy; 0x73uy; 0x20uy; 0x33uy; 0x32uy; 0x2duy; 0x62uy; 0x79uy; 0x74uy; 0x65uy; 0x20uy; 0x6buy; 0x65uy; 0x79uy; 0x20uy; 0x66uy; 0x6fuy; 0x72uy; 0x20uy; 0x50uy; 0x6fuy; 0x6cuy; 0x79uy; 0x31uy; 0x33uy; 0x30uy; 0x35uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key18_len: (x:UInt32.t { UInt32.v x = B.length key18 }) =
32ul
let tag18: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0xa6uy; 0xf7uy; 0x45uy; 0x00uy; 0x8fuy; 0x81uy; 0xc9uy; 0x16uy; 0xa2uy; 0x0duy; 0xccuy; 0x74uy; 0xeeuy; 0xf2uy; 0xb2uy; 0xf0uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag18_len: (x:UInt32.t { UInt32.v x = B.length tag18 }) =
16ul
let input19: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input19_len: (x:UInt32.t { UInt32.v x = B.length input19 }) =
32ul
let key19: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x74uy; 0x68uy; 0x69uy; 0x73uy; 0x20uy; 0x69uy; 0x73uy; 0x20uy; 0x33uy; 0x32uy; 0x2duy; 0x62uy; 0x79uy; 0x74uy; 0x65uy; 0x20uy; 0x6buy; 0x65uy; 0x79uy; 0x20uy; 0x66uy; 0x6fuy; 0x72uy; 0x20uy; 0x50uy; 0x6fuy; 0x6cuy; 0x79uy; 0x31uy; 0x33uy; 0x30uy; 0x35uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key19_len: (x:UInt32.t { UInt32.v x = B.length key19 }) =
32ul
let tag19: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0x49uy; 0xecuy; 0x78uy; 0x09uy; 0x0euy; 0x48uy; 0x1euy; 0xc6uy; 0xc2uy; 0x6buy; 0x33uy; 0xb9uy; 0x1cuy; 0xccuy; 0x03uy; 0x07uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag19_len: (x:UInt32.t { UInt32.v x = B.length tag19 }) =
16ul
let input20: (b: B.buffer UInt8.t { B.length b = 128 /\ B.recallable b }) =
[@inline_let] let l = [ 0x89uy; 0xdauy; 0xb8uy; 0x0buy; 0x77uy; 0x17uy; 0xc1uy; 0xdbuy; 0x5duy; 0xb4uy; 0x37uy; 0x86uy; 0x0auy; 0x3fuy; 0x70uy; 0x21uy; 0x8euy; 0x93uy; 0xe1uy; 0xb8uy; 0xf4uy; 0x61uy; 0xfbuy; 0x67uy; 0x7fuy; 0x16uy; 0xf3uy; 0x5fuy; 0x6fuy; 0x87uy; 0xe2uy; 0xa9uy; 0x1cuy; 0x99uy; 0xbcuy; 0x3auy; 0x47uy; 0xacuy; 0xe4uy; 0x76uy; 0x40uy; 0xccuy; 0x95uy; 0xc3uy; 0x45uy; 0xbeuy; 0x5euy; 0xccuy; 0xa5uy; 0xa3uy; 0x52uy; 0x3cuy; 0x35uy; 0xccuy; 0x01uy; 0x89uy; 0x3auy; 0xf0uy; 0xb6uy; 0x4auy; 0x62uy; 0x03uy; 0x34uy; 0x27uy; 0x03uy; 0x72uy; 0xecuy; 0x12uy; 0x48uy; 0x2duy; 0x1buy; 0x1euy; 0x36uy; 0x35uy; 0x61uy; 0x69uy; 0x8auy; 0x57uy; 0x8buy; 0x35uy; 0x98uy; 0x03uy; 0x49uy; 0x5buy; 0xb4uy; 0xe2uy; 0xefuy; 0x19uy; 0x30uy; 0xb1uy; 0x7auy; 0x51uy; 0x90uy; 0xb5uy; 0x80uy; 0xf1uy; 0x41uy; 0x30uy; 0x0duy; 0xf3uy; 0x0auy; 0xdbuy; 0xecuy; 0xa2uy; 0x8fuy; 0x64uy; 0x27uy; 0xa8uy; 0xbcuy; 0x1auy; 0x99uy; 0x9fuy; 0xd5uy; 0x1cuy; 0x55uy; 0x4auy; 0x01uy; 0x7duy; 0x09uy; 0x5duy; 0x8cuy; 0x3euy; 0x31uy; 0x27uy; 0xdauy; 0xf9uy; 0xf5uy; 0x95uy; ] in
assert_norm (List.Tot.length l = 128);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input20_len: (x:UInt32.t { UInt32.v x = B.length input20 }) =
128ul
let key20: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x2duy; 0x77uy; 0x3buy; 0xe3uy; 0x7auy; 0xdbuy; 0x1euy; 0x4duy; 0x68uy; 0x3buy; 0xf0uy; 0x07uy; 0x5euy; 0x79uy; 0xc4uy; 0xeeuy; 0x03uy; 0x79uy; 0x18uy; 0x53uy; 0x5auy; 0x7fuy; 0x99uy; 0xccuy; 0xb7uy; 0x04uy; 0x0fuy; 0xb5uy; 0xf5uy; 0xf4uy; 0x3auy; 0xeauy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key20_len: (x:UInt32.t { UInt32.v x = B.length key20 }) =
32ul
let tag20: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0xc8uy; 0x5duy; 0x15uy; 0xeduy; 0x44uy; 0xc3uy; 0x78uy; 0xd6uy; 0xb0uy; 0x0euy; 0x23uy; 0x06uy; 0x4cuy; 0x7buy; 0xcduy; 0x51uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag20_len: (x:UInt32.t { UInt32.v x = B.length tag20 }) =
16ul
let input21: (b: B.buffer UInt8.t { B.length b = 528 /\ B.recallable b }) =
[@inline_let] let l = [ 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x0buy; 0x17uy; 0x03uy; 0x03uy; 0x02uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x06uy; 0xdbuy; 0x1fuy; 0x1fuy; 0x36uy; 0x8duy; 0x69uy; 0x6auy; 0x81uy; 0x0auy; 0x34uy; 0x9cuy; 0x0cuy; 0x71uy; 0x4cuy; 0x9auy; 0x5euy; 0x78uy; 0x50uy; 0xc2uy; 0x40uy; 0x7duy; 0x72uy; 0x1auy; 0xcduy; 0xeduy; 0x95uy; 0xe0uy; 0x18uy; 0xd7uy; 0xa8uy; 0x52uy; 0x66uy; 0xa6uy; 0xe1uy; 0x28uy; 0x9cuy; 0xdbuy; 0x4auy; 0xebuy; 0x18uy; 0xdauy; 0x5auy; 0xc8uy; 0xa2uy; 0xb0uy; 0x02uy; 0x6duy; 0x24uy; 0xa5uy; 0x9auy; 0xd4uy; 0x85uy; 0x22uy; 0x7fuy; 0x3euy; 0xaeuy; 0xdbuy; 0xb2uy; 0xe7uy; 0xe3uy; 0x5euy; 0x1cuy; 0x66uy; 0xcduy; 0x60uy; 0xf9uy; 0xabuy; 0xf7uy; 0x16uy; 0xdcuy; 0xc9uy; 0xacuy; 0x42uy; 0x68uy; 0x2duy; 0xd7uy; 0xdauy; 0xb2uy; 0x87uy; 0xa7uy; 0x02uy; 0x4cuy; 0x4euy; 0xefuy; 0xc3uy; 0x21uy; 0xccuy; 0x05uy; 0x74uy; 0xe1uy; 0x67uy; 0x93uy; 0xe3uy; 0x7cuy; 0xecuy; 0x03uy; 0xc5uy; 0xbduy; 0xa4uy; 0x2buy; 0x54uy; 0xc1uy; 0x14uy; 0xa8uy; 0x0buy; 0x57uy; 0xafuy; 0x26uy; 0x41uy; 0x6cuy; 0x7buy; 0xe7uy; 0x42uy; 0x00uy; 0x5euy; 0x20uy; 0x85uy; 0x5cuy; 0x73uy; 0xe2uy; 0x1duy; 0xc8uy; 0xe2uy; 0xeduy; 0xc9uy; 0xd4uy; 0x35uy; 0xcbuy; 0x6fuy; 0x60uy; 0x59uy; 0x28uy; 0x00uy; 0x11uy; 0xc2uy; 0x70uy; 0xb7uy; 0x15uy; 0x70uy; 0x05uy; 0x1cuy; 0x1cuy; 0x9buy; 0x30uy; 0x52uy; 0x12uy; 0x66uy; 0x20uy; 0xbcuy; 0x1euy; 0x27uy; 0x30uy; 0xfauy; 0x06uy; 0x6cuy; 0x7auy; 0x50uy; 0x9duy; 0x53uy; 0xc6uy; 0x0euy; 0x5auy; 0xe1uy; 0xb4uy; 0x0auy; 0xa6uy; 0xe3uy; 0x9euy; 0x49uy; 0x66uy; 0x92uy; 0x28uy; 0xc9uy; 0x0euy; 0xecuy; 0xb4uy; 0xa5uy; 0x0duy; 0xb3uy; 0x2auy; 0x50uy; 0xbcuy; 0x49uy; 0xe9uy; 0x0buy; 0x4fuy; 0x4buy; 0x35uy; 0x9auy; 0x1duy; 0xfduy; 0x11uy; 0x74uy; 0x9cuy; 0xd3uy; 0x86uy; 0x7fuy; 0xcfuy; 0x2fuy; 0xb7uy; 0xbbuy; 0x6cuy; 0xd4uy; 0x73uy; 0x8fuy; 0x6auy; 0x4auy; 0xd6uy; 0xf7uy; 0xcauy; 0x50uy; 0x58uy; 0xf7uy; 0x61uy; 0x88uy; 0x45uy; 0xafuy; 0x9fuy; 0x02uy; 0x0fuy; 0x6cuy; 0x3buy; 0x96uy; 0x7buy; 0x8fuy; 0x4cuy; 0xd4uy; 0xa9uy; 0x1euy; 0x28uy; 0x13uy; 0xb5uy; 0x07uy; 0xaeuy; 0x66uy; 0xf2uy; 0xd3uy; 0x5cuy; 0x18uy; 0x28uy; 0x4fuy; 0x72uy; 0x92uy; 0x18uy; 0x60uy; 0x62uy; 0xe1uy; 0x0fuy; 0xd5uy; 0x51uy; 0x0duy; 0x18uy; 0x77uy; 0x53uy; 0x51uy; 0xefuy; 0x33uy; 0x4euy; 0x76uy; 0x34uy; 0xabuy; 0x47uy; 0x43uy; 0xf5uy; 0xb6uy; 0x8fuy; 0x49uy; 0xaduy; 0xcauy; 0xb3uy; 0x84uy; 0xd3uy; 0xfduy; 0x75uy; 0xf7uy; 0x39uy; 0x0fuy; 0x40uy; 0x06uy; 0xefuy; 0x2auy; 0x29uy; 0x5cuy; 0x8cuy; 0x7auy; 0x07uy; 0x6auy; 0xd5uy; 0x45uy; 0x46uy; 0xcduy; 0x25uy; 0xd2uy; 0x10uy; 0x7fuy; 0xbeuy; 0x14uy; 0x36uy; 0xc8uy; 0x40uy; 0x92uy; 0x4auy; 0xaeuy; 0xbeuy; 0x5buy; 0x37uy; 0x08uy; 0x93uy; 0xcduy; 0x63uy; 0xd1uy; 0x32uy; 0x5buy; 0x86uy; 0x16uy; 0xfcuy; 0x48uy; 0x10uy; 0x88uy; 0x6buy; 0xc1uy; 0x52uy; 0xc5uy; 0x32uy; 0x21uy; 0xb6uy; 0xdfuy; 0x37uy; 0x31uy; 0x19uy; 0x39uy; 0x32uy; 0x55uy; 0xeeuy; 0x72uy; 0xbcuy; 0xaauy; 0x88uy; 0x01uy; 0x74uy; 0xf1uy; 0x71uy; 0x7fuy; 0x91uy; 0x84uy; 0xfauy; 0x91uy; 0x64uy; 0x6fuy; 0x17uy; 0xa2uy; 0x4auy; 0xc5uy; 0x5duy; 0x16uy; 0xbfuy; 0xdduy; 0xcauy; 0x95uy; 0x81uy; 0xa9uy; 0x2euy; 0xdauy; 0x47uy; 0x92uy; 0x01uy; 0xf0uy; 0xeduy; 0xbfuy; 0x63uy; 0x36uy; 0x00uy; 0xd6uy; 0x06uy; 0x6duy; 0x1auy; 0xb3uy; 0x6duy; 0x5duy; 0x24uy; 0x15uy; 0xd7uy; 0x13uy; 0x51uy; 0xbbuy; 0xcduy; 0x60uy; 0x8auy; 0x25uy; 0x10uy; 0x8duy; 0x25uy; 0x64uy; 0x19uy; 0x92uy; 0xc1uy; 0xf2uy; 0x6cuy; 0x53uy; 0x1cuy; 0xf9uy; 0xf9uy; 0x02uy; 0x03uy; 0xbcuy; 0x4cuy; 0xc1uy; 0x9fuy; 0x59uy; 0x27uy; 0xd8uy; 0x34uy; 0xb0uy; 0xa4uy; 0x71uy; 0x16uy; 0xd3uy; 0x88uy; 0x4buy; 0xbbuy; 0x16uy; 0x4buy; 0x8euy; 0xc8uy; 0x83uy; 0xd1uy; 0xacuy; 0x83uy; 0x2euy; 0x56uy; 0xb3uy; 0x91uy; 0x8auy; 0x98uy; 0x60uy; 0x1auy; 0x08uy; 0xd1uy; 0x71uy; 0x88uy; 0x15uy; 0x41uy; 0xd5uy; 0x94uy; 0xdbuy; 0x39uy; 0x9cuy; 0x6auy; 0xe6uy; 0x15uy; 0x12uy; 0x21uy; 0x74uy; 0x5auy; 0xecuy; 0x81uy; 0x4cuy; 0x45uy; 0xb0uy; 0xb0uy; 0x5buy; 0x56uy; 0x54uy; 0x36uy; 0xfduy; 0x6fuy; 0x13uy; 0x7auy; 0xa1uy; 0x0auy; 0x0cuy; 0x0buy; 0x64uy; 0x37uy; 0x61uy; 0xdbuy; 0xd6uy; 0xf9uy; 0xa9uy; 0xdcuy; 0xb9uy; 0x9buy; 0x1auy; 0x6euy; 0x69uy; 0x08uy; 0x54uy; 0xceuy; 0x07uy; 0x69uy; 0xcduy; 0xe3uy; 0x97uy; 0x61uy; 0xd8uy; 0x2fuy; 0xcduy; 0xecuy; 0x15uy; 0xf0uy; 0xd9uy; 0x2duy; 0x7duy; 0x8euy; 0x94uy; 0xaduy; 0xe8uy; 0xebuy; 0x83uy; 0xfbuy; 0xe0uy; ] in
assert_norm (List.Tot.length l = 528);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input21_len: (x:UInt32.t { UInt32.v x = B.length input21 }) =
528ul
let key21: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x99uy; 0xe5uy; 0x82uy; 0x2duy; 0xd4uy; 0x17uy; 0x3cuy; 0x99uy; 0x5euy; 0x3duy; 0xaeuy; 0x0duy; 0xdeuy; 0xfbuy; 0x97uy; 0x74uy; 0x3fuy; 0xdeuy; 0x3buy; 0x08uy; 0x01uy; 0x34uy; 0xb3uy; 0x9fuy; 0x76uy; 0xe9uy; 0xbfuy; 0x8duy; 0x0euy; 0x88uy; 0xd5uy; 0x46uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key21_len: (x:UInt32.t { UInt32.v x = B.length key21 }) =
32ul
let tag21: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0x26uy; 0x37uy; 0x40uy; 0x8fuy; 0xe1uy; 0x30uy; 0x86uy; 0xeauy; 0x73uy; 0xf9uy; 0x71uy; 0xe3uy; 0x42uy; 0x5euy; 0x28uy; 0x20uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag21_len: (x:UInt32.t { UInt32.v x = B.length tag21 }) =
16ul
let input22: (b: B.buffer UInt8.t { B.length b = 257 /\ B.recallable b }) =
[@inline_let] let l = [ 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0x80uy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xceuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xc5uy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xe3uy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xacuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xe6uy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0x00uy; 0x00uy; 0x00uy; 0xafuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xffuy; 0xffuy; 0xffuy; 0xf5uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0xffuy; 0xffuy; 0xffuy; 0xe7uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x71uy; 0x92uy; 0x05uy; 0xa8uy; 0x52uy; 0x1duy; 0xfcuy; ] in
assert_norm (List.Tot.length l = 257);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input22_len: (x:UInt32.t { UInt32.v x = B.length input22 }) =
257ul
let key22: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x7fuy; 0x1buy; 0x02uy; 0x64uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; 0xccuy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key22_len: (x:UInt32.t { UInt32.v x = B.length key22 }) =
32ul
let tag22: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0x85uy; 0x59uy; 0xb8uy; 0x76uy; 0xecuy; 0xeeuy; 0xd6uy; 0x6euy; 0xb3uy; 0x77uy; 0x98uy; 0xc0uy; 0x45uy; 0x7buy; 0xafuy; 0xf9uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag22_len: (x:UInt32.t { UInt32.v x = B.length tag22 }) =
16ul
let input23: (b: B.buffer UInt8.t { B.length b = 39 /\ B.recallable b }) =
[@inline_let] let l = [ 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x80uy; 0x02uy; 0x64uy; ] in
assert_norm (List.Tot.length l = 39);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input23_len: (x:UInt32.t { UInt32.v x = B.length input23 }) =
39ul
let key23: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0xe0uy; 0x00uy; 0x16uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; 0xaauy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key23_len: (x:UInt32.t { UInt32.v x = B.length key23 }) =
32ul
let tag23: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0x00uy; 0xbduy; 0x12uy; 0x58uy; 0x97uy; 0x8euy; 0x20uy; 0x54uy; 0x44uy; 0xc9uy; 0xaauy; 0xaauy; 0x82uy; 0x00uy; 0x6fuy; 0xeduy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag23_len: (x:UInt32.t { UInt32.v x = B.length tag23 }) =
16ul
let input24: (b: B.buffer UInt8.t { B.length b = 2 /\ B.recallable b }) =
[@inline_let] let l = [ 0x02uy; 0xfcuy; ] in
assert_norm (List.Tot.length l = 2);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input24_len: (x:UInt32.t { UInt32.v x = B.length input24 }) =
2ul
let key24: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key24_len: (x:UInt32.t { UInt32.v x = B.length key24 }) =
32ul
let tag24: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0x06uy; 0x12uy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; 0x0cuy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag24_len: (x:UInt32.t { UInt32.v x = B.length tag24 }) =
16ul | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Test.Vectors.Poly1305.fst"
} | [
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Test.Vectors",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test.Vectors",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | b:
LowStar.Buffer.buffer FStar.UInt8.t
{LowStar.Monotonic.Buffer.length b = 415 /\ LowStar.Monotonic.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"LowStar.Buffer.gcmalloc_of_list",
"FStar.UInt8.t",
"FStar.Monotonic.HyperHeap.root",
"LowStar.Monotonic.Buffer.mbuffer",
"LowStar.Buffer.trivial_preorder",
"Prims.l_and",
"Prims.eq2",
"Prims.nat",
"LowStar.Monotonic.Buffer.length",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.length",
"Prims.b2t",
"Prims.op_Negation",
"LowStar.Monotonic.Buffer.g_is_null",
"FStar.Monotonic.HyperHeap.rid",
"LowStar.Monotonic.Buffer.frameOf",
"LowStar.Monotonic.Buffer.recallable",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.op_Equality",
"Prims.int",
"LowStar.Buffer.buffer",
"Prims.list",
"Prims.Cons",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | false | false | false | false | false | let input25:(b: B.buffer UInt8.t {B.length b = 415 /\ B.recallable b}) =
| [@@ inline_let ]let l =
[
0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy;
0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy;
0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy;
0x7buy; 0x7buy; 0x7auy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy;
0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy;
0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x5cuy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy;
0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy;
0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy;
0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy;
0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x6euy; 0x7buy; 0x00uy; 0x7buy;
0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy;
0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy;
0x7buy; 0x7buy; 0x7buy; 0x7auy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy;
0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy;
0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x5cuy; 0x7buy; 0x7buy; 0x7buy; 0x7buy;
0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy;
0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy;
0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy;
0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x7buy; 0x6euy; 0x7buy; 0x00uy;
0x13uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0xb3uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy;
0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy;
0x00uy; 0x00uy; 0x00uy; 0x00uy; 0xf2uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy;
0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x20uy;
0x00uy; 0xefuy; 0xffuy; 0x00uy; 0x09uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy;
0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x10uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x09uy; 0x00uy;
0x00uy; 0x00uy; 0x64uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy;
0x00uy; 0x00uy; 0x00uy; 0x13uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0xb3uy; 0x00uy; 0x00uy; 0x00uy;
0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy;
0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0xf2uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy;
0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy;
0x00uy; 0x00uy; 0x20uy; 0x00uy; 0xefuy; 0xffuy; 0x00uy; 0x09uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy;
0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x7auy; 0x00uy; 0x00uy; 0x10uy; 0x00uy; 0x00uy; 0x00uy;
0x00uy; 0x09uy; 0x00uy; 0x00uy; 0x00uy; 0x64uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy;
0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy;
0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0xfcuy
]
in
assert_norm (List.Tot.length l = 415);
B.gcmalloc_of_list HyperStack.root l | false |
SfPoly.fst | SfPoly.evenb' | val evenb' : nat -> Tot bool | val evenb' : nat -> Tot bool | let rec evenb' i =
match i with
| 0 -> true
| 1 -> false
| _ -> evenb' (i-2) | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 21,
"end_line": 196,
"start_col": 0,
"start_line": 192
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *)
val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c
let prod_curry f x y = f (x,y)
val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c
let prod_uncurry f xy = f (fst xy) (snd xy)
val test_prod_uncurry: f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_uncurry f) (x, y) == f x y))
let test_prod_uncurry f x y = ()
val test_prod_curry: f:(('a * 'b)->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_curry f) x y == f (x, y)))
let test_prod_curry f x y = ()
val uncurry_curry : f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures (prod_curry (prod_uncurry f) x y == f x y))
let uncurry_curry f x y = ()
val curry_uncurry : f:(('a*'b)->Tot 'c) -> xy:('a*'b) -> Lemma
(ensures (prod_uncurry (prod_curry f) xy == f xy))
let curry_uncurry f xy = ()
(* Filter *)
val filter : test:('a->Tot bool) -> l:(list 'a) -> Tot (list 'a)
let rec filter test l =
match l with
| [] -> []
| h :: t -> if test h then h :: (filter test t)
else filter test t
val evenb : nat -> Tot bool
let evenb i = i%2 = 0
(* NS: Note: induction over non-inductive types like int is also fine *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | i: Prims.nat -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Prims.int",
"SfPoly.evenb'",
"Prims.op_Subtraction",
"Prims.bool"
] | [
"recursion"
] | false | false | false | true | false | let rec evenb' i =
| match i with
| 0 -> true
| 1 -> false
| _ -> evenb' (i - 2) | false |
SfPoly.fst | SfPoly.filter | val filter : test:('a->Tot bool) -> l:(list 'a) -> Tot (list 'a) | val filter : test:('a->Tot bool) -> l:(list 'a) -> Tot (list 'a) | let rec filter test l =
match l with
| [] -> []
| h :: t -> if test h then h :: (filter test t)
else filter test t | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 48,
"end_line": 185,
"start_col": 0,
"start_line": 181
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *)
val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c
let prod_curry f x y = f (x,y)
val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c
let prod_uncurry f xy = f (fst xy) (snd xy)
val test_prod_uncurry: f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_uncurry f) (x, y) == f x y))
let test_prod_uncurry f x y = ()
val test_prod_curry: f:(('a * 'b)->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_curry f) x y == f (x, y)))
let test_prod_curry f x y = ()
val uncurry_curry : f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures (prod_curry (prod_uncurry f) x y == f x y))
let uncurry_curry f x y = ()
val curry_uncurry : f:(('a*'b)->Tot 'c) -> xy:('a*'b) -> Lemma
(ensures (prod_uncurry (prod_curry f) xy == f xy))
let curry_uncurry f xy = ()
(* Filter *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 | test: (_: 'a -> Prims.bool) -> l: Prims.list 'a -> Prims.list 'a | Prims.Tot | [
"total"
] | [] | [
"Prims.bool",
"Prims.list",
"Prims.Nil",
"Prims.Cons",
"SfPoly.filter"
] | [
"recursion"
] | false | false | false | true | false | let rec filter test l =
| match l with
| [] -> []
| h :: t -> if test h then h :: (filter test t) else filter test t | false |
SfPoly.fst | SfPoly.index | val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a | val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a | let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1) | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 48,
"end_line": 143,
"start_col": 0,
"start_line": 141
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = () | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | l: Prims.list 'a -> n: Prims.int{0 <= n /\ n < SfPoly.length l} -> 'a | Prims.Tot | [
"total"
] | [] | [
"Prims.list",
"Prims.int",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"SfPoly.length",
"Prims.op_Equality",
"Prims.bool",
"SfPoly.index",
"Prims.op_Subtraction"
] | [
"recursion"
] | false | false | false | false | false | let rec index l n =
| match l with | h :: t -> if n = 0 then h else index t (n - 1) | false |
Steel.SpinLock.fst | Steel.SpinLock.new_lock | val new_lock (p:vprop)
: SteelT (lock p) p (fun _ -> emp) | val new_lock (p:vprop)
: SteelT (lock p) p (fun _ -> emp) | let new_lock (p:vprop)
: SteelT (lock p) p (fun _ -> emp) =
let r = alloc_pt available in
intro_lockinv_available p r;
let i:inv (lockinv p r) = new_invariant (lockinv p r) in
return (Lock r i) | {
"file_name": "lib/steel/Steel.SpinLock.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 19,
"end_line": 59,
"start_col": 0,
"start_line": 54
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.SpinLock
open FStar.Ghost
open Steel.Effect.Atomic
open Steel.Effect
open Steel.Reference
open Steel.FractionalPermission
#set-options "--ide_id_info_off --fuel 0 --ifuel 0"
let available = false
let locked = true
let lockinv (p:vprop) (r:ref bool) : vprop =
h_exists (fun b -> pts_to r full_perm b `star` (if b then emp else p))
noeq
type lock (p:vprop) = | Lock: r: ref bool -> i: inv (lockinv p r) -> lock p
val intro_lockinv_available (#uses:inames) (p:vprop) (r:ref bool)
: SteelGhostT unit uses (pts_to r full_perm available `star` p) (fun _ -> lockinv p r)
val intro_lockinv_locked (#uses:inames) (p:vprop) (r:ref bool)
: SteelGhostT unit uses (pts_to r full_perm locked) (fun _ -> lockinv p r)
let intro_lockinv_available #uses p r =
intro_exists false
(fun (b: bool) ->
pts_to r full_perm b `star`
(if b then emp else p)
)
let intro_lockinv_locked #uses p r =
intro_exists true
(fun b -> pts_to r full_perm b `star`
(if b then emp else p)) | {
"checked_file": "/",
"dependencies": [
"Steel.Reference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.SpinLock.fst"
} | [
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | p: Steel.Effect.Common.vprop -> Steel.Effect.SteelT (Steel.SpinLock.lock p) | Steel.Effect.SteelT | [] | [] | [
"Steel.Effect.Common.vprop",
"Steel.Effect.Atomic.return",
"Steel.SpinLock.lock",
"FStar.Ghost.hide",
"FStar.Set.set",
"Steel.Memory.iname",
"FStar.Set.empty",
"FStar.Algebra.CommMonoid.Equiv.__proj__CM__item__unit",
"Steel.Effect.Common.req",
"Steel.Effect.Common.rm",
"Steel.SpinLock.Lock",
"Steel.Effect.Common.inv",
"Steel.SpinLock.lockinv",
"Steel.Effect.Atomic.new_invariant",
"Prims.unit",
"Steel.SpinLock.intro_lockinv_available",
"Steel.Reference.ref",
"Prims.bool",
"Steel.Reference.alloc_pt",
"Steel.SpinLock.available",
"Steel.Effect.Common.emp"
] | [] | false | true | false | false | false | let new_lock (p: vprop) : SteelT (lock p) p (fun _ -> emp) =
| let r = alloc_pt available in
intro_lockinv_available p r;
let i:inv (lockinv p r) = new_invariant (lockinv p r) in
return (Lock r i) | false |
SfPoly.fst | SfPoly.constfun | val constfun : 'a -> 'b -> Tot 'a | val constfun : 'a -> 'b -> Tot 'a | let constfun x _ = x | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 20,
"end_line": 276,
"start_col": 0,
"start_line": 276
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *)
val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c
let prod_curry f x y = f (x,y)
val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c
let prod_uncurry f xy = f (fst xy) (snd xy)
val test_prod_uncurry: f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_uncurry f) (x, y) == f x y))
let test_prod_uncurry f x y = ()
val test_prod_curry: f:(('a * 'b)->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_curry f) x y == f (x, y)))
let test_prod_curry f x y = ()
val uncurry_curry : f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures (prod_curry (prod_uncurry f) x y == f x y))
let uncurry_curry f x y = ()
val curry_uncurry : f:(('a*'b)->Tot 'c) -> xy:('a*'b) -> Lemma
(ensures (prod_uncurry (prod_curry f) xy == f xy))
let curry_uncurry f xy = ()
(* Filter *)
val filter : test:('a->Tot bool) -> l:(list 'a) -> Tot (list 'a)
let rec filter test l =
match l with
| [] -> []
| h :: t -> if test h then h :: (filter test t)
else filter test t
val evenb : nat -> Tot bool
let evenb i = i%2 = 0
(* NS: Note: induction over non-inductive types like int is also fine *)
val evenb' : nat -> Tot bool
let rec evenb' i =
match i with
| 0 -> true
| 1 -> false
| _ -> evenb' (i-2)
val oddb : nat -> Tot bool
let oddb n = not (evenb n)
val test_filter1 : unit -> Lemma
(ensures (filter evenb [1;2;3;4] = [2;4]))
let test_filter1 () = ()
val test_filter2 : unit -> Lemma
(ensures (filter evenb' [1;2;3;4] = [2;4]))
let test_filter2 () = ()
(* Map *)
val map : ('a->Tot 'b) -> (list 'a) -> Tot (list 'b)
let rec map f l =
match l with
| [] -> []
| h :: t -> (f h) :: (map f t)
val test_map1 : unit -> Lemma
(ensures (map (fun n -> n + 3) [2;0;2] = [5;3;5]))
let test_map1 () = ()
val test_map2 : unit -> Lemma
(ensures (map oddb [2;1;2;5] = [false;true;false;true]))
let test_map2 () = ()
val test_map3 : unit -> Lemma
(ensures (map (fun n -> [evenb n;oddb n]) [2;1;2;5]
= [[true;false];[false;true];[true;false];[false;true]]))
let test_map3 () = ()
val map_snoc : f:('a->Tot 'b) -> x:'a -> l:list 'a -> Lemma
(ensures (map f (snoc l x) == snoc (map f l) (f x)))
let rec map_snoc f x l =
match l with
| [] -> ()
| h::t -> map_snoc f x t
val map_rev : f:('a->Tot 'b) -> l:(list 'a) -> Lemma
(ensures (map f (rev l) == rev (map f l)))
let rec map_rev f l =
match l with
| [] -> ()
| h::t -> map_snoc f h (rev t); map_rev f t
(* Map for options *)
val option_map : ('a -> Tot 'b) -> option 'a -> Tot (option 'b)
let option_map f o =
match o with
| None -> None
| Some a -> Some (f a)
(* Fold *)
val fold : (f : 'a -> 'b -> Tot 'b) -> list 'a -> 'b -> Tot 'b
let rec fold f l b =
match l with
| [] -> b
| h::t -> f h (fold f t b)
val fold_example1 : unit -> Lemma
(ensures (let open FStar.Mul in
fold (fun x y -> x * y) [1;2;3;4] 1 = 24))
let fold_example1 () = ()
val fold_example2 : unit -> Lemma
(ensures (fold (fun x y -> x && y) [true;true;false;true] true = false))
let fold_example2 () = ()
val fold_example3 : unit -> Lemma
(ensures (fold app [[1];[];[2;3];[4]] [] = [1;2;3;4]))
let fold_example3 () = ()
(* Functions For Constructing Functions *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 -> _: 'b -> 'a | Prims.Tot | [
"total"
] | [] | [] | [] | false | false | false | true | false | let constfun x _ =
| x | false |
SfPoly.fst | SfPoly.ftrue | val ftrue : 'b -> Tot bool | val ftrue : 'b -> Tot bool | let ftrue _ = true | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 18,
"end_line": 281,
"start_col": 0,
"start_line": 281
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *)
val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c
let prod_curry f x y = f (x,y)
val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c
let prod_uncurry f xy = f (fst xy) (snd xy)
val test_prod_uncurry: f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_uncurry f) (x, y) == f x y))
let test_prod_uncurry f x y = ()
val test_prod_curry: f:(('a * 'b)->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_curry f) x y == f (x, y)))
let test_prod_curry f x y = ()
val uncurry_curry : f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures (prod_curry (prod_uncurry f) x y == f x y))
let uncurry_curry f x y = ()
val curry_uncurry : f:(('a*'b)->Tot 'c) -> xy:('a*'b) -> Lemma
(ensures (prod_uncurry (prod_curry f) xy == f xy))
let curry_uncurry f xy = ()
(* Filter *)
val filter : test:('a->Tot bool) -> l:(list 'a) -> Tot (list 'a)
let rec filter test l =
match l with
| [] -> []
| h :: t -> if test h then h :: (filter test t)
else filter test t
val evenb : nat -> Tot bool
let evenb i = i%2 = 0
(* NS: Note: induction over non-inductive types like int is also fine *)
val evenb' : nat -> Tot bool
let rec evenb' i =
match i with
| 0 -> true
| 1 -> false
| _ -> evenb' (i-2)
val oddb : nat -> Tot bool
let oddb n = not (evenb n)
val test_filter1 : unit -> Lemma
(ensures (filter evenb [1;2;3;4] = [2;4]))
let test_filter1 () = ()
val test_filter2 : unit -> Lemma
(ensures (filter evenb' [1;2;3;4] = [2;4]))
let test_filter2 () = ()
(* Map *)
val map : ('a->Tot 'b) -> (list 'a) -> Tot (list 'b)
let rec map f l =
match l with
| [] -> []
| h :: t -> (f h) :: (map f t)
val test_map1 : unit -> Lemma
(ensures (map (fun n -> n + 3) [2;0;2] = [5;3;5]))
let test_map1 () = ()
val test_map2 : unit -> Lemma
(ensures (map oddb [2;1;2;5] = [false;true;false;true]))
let test_map2 () = ()
val test_map3 : unit -> Lemma
(ensures (map (fun n -> [evenb n;oddb n]) [2;1;2;5]
= [[true;false];[false;true];[true;false];[false;true]]))
let test_map3 () = ()
val map_snoc : f:('a->Tot 'b) -> x:'a -> l:list 'a -> Lemma
(ensures (map f (snoc l x) == snoc (map f l) (f x)))
let rec map_snoc f x l =
match l with
| [] -> ()
| h::t -> map_snoc f x t
val map_rev : f:('a->Tot 'b) -> l:(list 'a) -> Lemma
(ensures (map f (rev l) == rev (map f l)))
let rec map_rev f l =
match l with
| [] -> ()
| h::t -> map_snoc f h (rev t); map_rev f t
(* Map for options *)
val option_map : ('a -> Tot 'b) -> option 'a -> Tot (option 'b)
let option_map f o =
match o with
| None -> None
| Some a -> Some (f a)
(* Fold *)
val fold : (f : 'a -> 'b -> Tot 'b) -> list 'a -> 'b -> Tot 'b
let rec fold f l b =
match l with
| [] -> b
| h::t -> f h (fold f t b)
val fold_example1 : unit -> Lemma
(ensures (let open FStar.Mul in
fold (fun x y -> x * y) [1;2;3;4] 1 = 24))
let fold_example1 () = ()
val fold_example2 : unit -> Lemma
(ensures (fold (fun x y -> x && y) [true;true;false;true] true = false))
let fold_example2 () = ()
val fold_example3 : unit -> Lemma
(ensures (fold app [[1];[];[2;3];[4]] [] = [1;2;3;4]))
let fold_example3 () = ()
(* Functions For Constructing Functions *)
val constfun : 'a -> 'b -> Tot 'a
let constfun x _ = x
val ftrue : 'b -> Tot bool
(* This should work, but it doesn't: causes failed postconditions later on | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"Prims.bool"
] | [] | false | false | false | true | false | let ftrue _ =
| true | false |
SfPoly.fst | SfPoly.my_override | val my_override : #a:eqtype -> #b:Type -> (a -> Tot b) -> a -> b -> a -> Tot b | val my_override : #a:eqtype -> #b:Type -> (a -> Tot b) -> a -> b -> a -> Tot b | let my_override #a #b f k x k' = if k = k' then x else f k' | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 59,
"end_line": 294,
"start_col": 0,
"start_line": 294
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *)
val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c
let prod_curry f x y = f (x,y)
val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c
let prod_uncurry f xy = f (fst xy) (snd xy)
val test_prod_uncurry: f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_uncurry f) (x, y) == f x y))
let test_prod_uncurry f x y = ()
val test_prod_curry: f:(('a * 'b)->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_curry f) x y == f (x, y)))
let test_prod_curry f x y = ()
val uncurry_curry : f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures (prod_curry (prod_uncurry f) x y == f x y))
let uncurry_curry f x y = ()
val curry_uncurry : f:(('a*'b)->Tot 'c) -> xy:('a*'b) -> Lemma
(ensures (prod_uncurry (prod_curry f) xy == f xy))
let curry_uncurry f xy = ()
(* Filter *)
val filter : test:('a->Tot bool) -> l:(list 'a) -> Tot (list 'a)
let rec filter test l =
match l with
| [] -> []
| h :: t -> if test h then h :: (filter test t)
else filter test t
val evenb : nat -> Tot bool
let evenb i = i%2 = 0
(* NS: Note: induction over non-inductive types like int is also fine *)
val evenb' : nat -> Tot bool
let rec evenb' i =
match i with
| 0 -> true
| 1 -> false
| _ -> evenb' (i-2)
val oddb : nat -> Tot bool
let oddb n = not (evenb n)
val test_filter1 : unit -> Lemma
(ensures (filter evenb [1;2;3;4] = [2;4]))
let test_filter1 () = ()
val test_filter2 : unit -> Lemma
(ensures (filter evenb' [1;2;3;4] = [2;4]))
let test_filter2 () = ()
(* Map *)
val map : ('a->Tot 'b) -> (list 'a) -> Tot (list 'b)
let rec map f l =
match l with
| [] -> []
| h :: t -> (f h) :: (map f t)
val test_map1 : unit -> Lemma
(ensures (map (fun n -> n + 3) [2;0;2] = [5;3;5]))
let test_map1 () = ()
val test_map2 : unit -> Lemma
(ensures (map oddb [2;1;2;5] = [false;true;false;true]))
let test_map2 () = ()
val test_map3 : unit -> Lemma
(ensures (map (fun n -> [evenb n;oddb n]) [2;1;2;5]
= [[true;false];[false;true];[true;false];[false;true]]))
let test_map3 () = ()
val map_snoc : f:('a->Tot 'b) -> x:'a -> l:list 'a -> Lemma
(ensures (map f (snoc l x) == snoc (map f l) (f x)))
let rec map_snoc f x l =
match l with
| [] -> ()
| h::t -> map_snoc f x t
val map_rev : f:('a->Tot 'b) -> l:(list 'a) -> Lemma
(ensures (map f (rev l) == rev (map f l)))
let rec map_rev f l =
match l with
| [] -> ()
| h::t -> map_snoc f h (rev t); map_rev f t
(* Map for options *)
val option_map : ('a -> Tot 'b) -> option 'a -> Tot (option 'b)
let option_map f o =
match o with
| None -> None
| Some a -> Some (f a)
(* Fold *)
val fold : (f : 'a -> 'b -> Tot 'b) -> list 'a -> 'b -> Tot 'b
let rec fold f l b =
match l with
| [] -> b
| h::t -> f h (fold f t b)
val fold_example1 : unit -> Lemma
(ensures (let open FStar.Mul in
fold (fun x y -> x * y) [1;2;3;4] 1 = 24))
let fold_example1 () = ()
val fold_example2 : unit -> Lemma
(ensures (fold (fun x y -> x && y) [true;true;false;true] true = false))
let fold_example2 () = ()
val fold_example3 : unit -> Lemma
(ensures (fold app [[1];[];[2;3];[4]] [] = [1;2;3;4]))
let fold_example3 () = ()
(* Functions For Constructing Functions *)
val constfun : 'a -> 'b -> Tot 'a
let constfun x _ = x
val ftrue : 'b -> Tot bool
(* This should work, but it doesn't: causes failed postconditions later on
let ftrue = constfun true *)
let ftrue _ = true
(* CH: This causes syntax error at character 12, is override a
keyword?
NS: Yes, override is a keyword. Only because it is a keyword in F#,
and since we (plan to) codegen to F# and Caml, unless we mangle
names, we inherit their keywords.
val override : ('a -> Tot 'b) -> 'a -> 'b -> 'a -> Tot 'b
*) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 | f: (_: a -> b) -> k: a -> x: b -> k': a -> b | Prims.Tot | [
"total"
] | [] | [
"Prims.eqtype",
"Prims.op_Equality",
"Prims.bool"
] | [] | false | false | false | false | false | let my_override #a #b f k x k' =
| if k = k' then x else f k' | false |
SfPoly.fst | SfPoly.fmostlytrue | val fmostlytrue : int -> Tot bool | val fmostlytrue : int -> Tot bool | let fmostlytrue x = my_override (my_override ftrue 1 false) 3 false x | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 69,
"end_line": 297,
"start_col": 0,
"start_line": 297
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *)
val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c
let prod_curry f x y = f (x,y)
val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c
let prod_uncurry f xy = f (fst xy) (snd xy)
val test_prod_uncurry: f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_uncurry f) (x, y) == f x y))
let test_prod_uncurry f x y = ()
val test_prod_curry: f:(('a * 'b)->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_curry f) x y == f (x, y)))
let test_prod_curry f x y = ()
val uncurry_curry : f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures (prod_curry (prod_uncurry f) x y == f x y))
let uncurry_curry f x y = ()
val curry_uncurry : f:(('a*'b)->Tot 'c) -> xy:('a*'b) -> Lemma
(ensures (prod_uncurry (prod_curry f) xy == f xy))
let curry_uncurry f xy = ()
(* Filter *)
val filter : test:('a->Tot bool) -> l:(list 'a) -> Tot (list 'a)
let rec filter test l =
match l with
| [] -> []
| h :: t -> if test h then h :: (filter test t)
else filter test t
val evenb : nat -> Tot bool
let evenb i = i%2 = 0
(* NS: Note: induction over non-inductive types like int is also fine *)
val evenb' : nat -> Tot bool
let rec evenb' i =
match i with
| 0 -> true
| 1 -> false
| _ -> evenb' (i-2)
val oddb : nat -> Tot bool
let oddb n = not (evenb n)
val test_filter1 : unit -> Lemma
(ensures (filter evenb [1;2;3;4] = [2;4]))
let test_filter1 () = ()
val test_filter2 : unit -> Lemma
(ensures (filter evenb' [1;2;3;4] = [2;4]))
let test_filter2 () = ()
(* Map *)
val map : ('a->Tot 'b) -> (list 'a) -> Tot (list 'b)
let rec map f l =
match l with
| [] -> []
| h :: t -> (f h) :: (map f t)
val test_map1 : unit -> Lemma
(ensures (map (fun n -> n + 3) [2;0;2] = [5;3;5]))
let test_map1 () = ()
val test_map2 : unit -> Lemma
(ensures (map oddb [2;1;2;5] = [false;true;false;true]))
let test_map2 () = ()
val test_map3 : unit -> Lemma
(ensures (map (fun n -> [evenb n;oddb n]) [2;1;2;5]
= [[true;false];[false;true];[true;false];[false;true]]))
let test_map3 () = ()
val map_snoc : f:('a->Tot 'b) -> x:'a -> l:list 'a -> Lemma
(ensures (map f (snoc l x) == snoc (map f l) (f x)))
let rec map_snoc f x l =
match l with
| [] -> ()
| h::t -> map_snoc f x t
val map_rev : f:('a->Tot 'b) -> l:(list 'a) -> Lemma
(ensures (map f (rev l) == rev (map f l)))
let rec map_rev f l =
match l with
| [] -> ()
| h::t -> map_snoc f h (rev t); map_rev f t
(* Map for options *)
val option_map : ('a -> Tot 'b) -> option 'a -> Tot (option 'b)
let option_map f o =
match o with
| None -> None
| Some a -> Some (f a)
(* Fold *)
val fold : (f : 'a -> 'b -> Tot 'b) -> list 'a -> 'b -> Tot 'b
let rec fold f l b =
match l with
| [] -> b
| h::t -> f h (fold f t b)
val fold_example1 : unit -> Lemma
(ensures (let open FStar.Mul in
fold (fun x y -> x * y) [1;2;3;4] 1 = 24))
let fold_example1 () = ()
val fold_example2 : unit -> Lemma
(ensures (fold (fun x y -> x && y) [true;true;false;true] true = false))
let fold_example2 () = ()
val fold_example3 : unit -> Lemma
(ensures (fold app [[1];[];[2;3];[4]] [] = [1;2;3;4]))
let fold_example3 () = ()
(* Functions For Constructing Functions *)
val constfun : 'a -> 'b -> Tot 'a
let constfun x _ = x
val ftrue : 'b -> Tot bool
(* This should work, but it doesn't: causes failed postconditions later on
let ftrue = constfun true *)
let ftrue _ = true
(* CH: This causes syntax error at character 12, is override a
keyword?
NS: Yes, override is a keyword. Only because it is a keyword in F#,
and since we (plan to) codegen to F# and Caml, unless we mangle
names, we inherit their keywords.
val override : ('a -> Tot 'b) -> 'a -> 'b -> 'a -> Tot 'b
*)
val my_override : #a:eqtype -> #b:Type -> (a -> Tot b) -> a -> b -> a -> Tot b
let my_override #a #b f k x k' = if k = k' then x else f k' | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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: Prims.int -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"Prims.int",
"SfPoly.my_override",
"Prims.bool",
"SfPoly.ftrue"
] | [] | false | false | false | true | false | let fmostlytrue x =
| my_override (my_override ftrue 1 false) 3 false x | false |
SfPoly.fst | SfPoly.map | val map : ('a->Tot 'b) -> (list 'a) -> Tot (list 'b) | val map : ('a->Tot 'b) -> (list 'a) -> Tot (list 'b) | let rec map f l =
match l with
| [] -> []
| h :: t -> (f h) :: (map f t) | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 32,
"end_line": 215,
"start_col": 0,
"start_line": 212
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *)
val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c
let prod_curry f x y = f (x,y)
val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c
let prod_uncurry f xy = f (fst xy) (snd xy)
val test_prod_uncurry: f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_uncurry f) (x, y) == f x y))
let test_prod_uncurry f x y = ()
val test_prod_curry: f:(('a * 'b)->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_curry f) x y == f (x, y)))
let test_prod_curry f x y = ()
val uncurry_curry : f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures (prod_curry (prod_uncurry f) x y == f x y))
let uncurry_curry f x y = ()
val curry_uncurry : f:(('a*'b)->Tot 'c) -> xy:('a*'b) -> Lemma
(ensures (prod_uncurry (prod_curry f) xy == f xy))
let curry_uncurry f xy = ()
(* Filter *)
val filter : test:('a->Tot bool) -> l:(list 'a) -> Tot (list 'a)
let rec filter test l =
match l with
| [] -> []
| h :: t -> if test h then h :: (filter test t)
else filter test t
val evenb : nat -> Tot bool
let evenb i = i%2 = 0
(* NS: Note: induction over non-inductive types like int is also fine *)
val evenb' : nat -> Tot bool
let rec evenb' i =
match i with
| 0 -> true
| 1 -> false
| _ -> evenb' (i-2)
val oddb : nat -> Tot bool
let oddb n = not (evenb n)
val test_filter1 : unit -> Lemma
(ensures (filter evenb [1;2;3;4] = [2;4]))
let test_filter1 () = ()
val test_filter2 : unit -> Lemma
(ensures (filter evenb' [1;2;3;4] = [2;4]))
let test_filter2 () = ()
(* Map *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 | f: (_: 'a -> 'b) -> l: Prims.list 'a -> Prims.list 'b | Prims.Tot | [
"total"
] | [] | [
"Prims.list",
"Prims.Nil",
"Prims.Cons",
"SfPoly.map"
] | [
"recursion"
] | false | false | false | true | false | let rec map f l =
| match l with
| [] -> []
| h :: t -> (f h) :: (map f t) | false |
SfPoly.fst | SfPoly.fold | val fold : (f : 'a -> 'b -> Tot 'b) -> list 'a -> 'b -> Tot 'b | val fold : (f : 'a -> 'b -> Tot 'b) -> list 'a -> 'b -> Tot 'b | let rec fold f l b =
match l with
| [] -> b
| h::t -> f h (fold f t b) | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 28,
"end_line": 258,
"start_col": 0,
"start_line": 255
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *)
val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c
let prod_curry f x y = f (x,y)
val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c
let prod_uncurry f xy = f (fst xy) (snd xy)
val test_prod_uncurry: f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_uncurry f) (x, y) == f x y))
let test_prod_uncurry f x y = ()
val test_prod_curry: f:(('a * 'b)->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_curry f) x y == f (x, y)))
let test_prod_curry f x y = ()
val uncurry_curry : f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures (prod_curry (prod_uncurry f) x y == f x y))
let uncurry_curry f x y = ()
val curry_uncurry : f:(('a*'b)->Tot 'c) -> xy:('a*'b) -> Lemma
(ensures (prod_uncurry (prod_curry f) xy == f xy))
let curry_uncurry f xy = ()
(* Filter *)
val filter : test:('a->Tot bool) -> l:(list 'a) -> Tot (list 'a)
let rec filter test l =
match l with
| [] -> []
| h :: t -> if test h then h :: (filter test t)
else filter test t
val evenb : nat -> Tot bool
let evenb i = i%2 = 0
(* NS: Note: induction over non-inductive types like int is also fine *)
val evenb' : nat -> Tot bool
let rec evenb' i =
match i with
| 0 -> true
| 1 -> false
| _ -> evenb' (i-2)
val oddb : nat -> Tot bool
let oddb n = not (evenb n)
val test_filter1 : unit -> Lemma
(ensures (filter evenb [1;2;3;4] = [2;4]))
let test_filter1 () = ()
val test_filter2 : unit -> Lemma
(ensures (filter evenb' [1;2;3;4] = [2;4]))
let test_filter2 () = ()
(* Map *)
val map : ('a->Tot 'b) -> (list 'a) -> Tot (list 'b)
let rec map f l =
match l with
| [] -> []
| h :: t -> (f h) :: (map f t)
val test_map1 : unit -> Lemma
(ensures (map (fun n -> n + 3) [2;0;2] = [5;3;5]))
let test_map1 () = ()
val test_map2 : unit -> Lemma
(ensures (map oddb [2;1;2;5] = [false;true;false;true]))
let test_map2 () = ()
val test_map3 : unit -> Lemma
(ensures (map (fun n -> [evenb n;oddb n]) [2;1;2;5]
= [[true;false];[false;true];[true;false];[false;true]]))
let test_map3 () = ()
val map_snoc : f:('a->Tot 'b) -> x:'a -> l:list 'a -> Lemma
(ensures (map f (snoc l x) == snoc (map f l) (f x)))
let rec map_snoc f x l =
match l with
| [] -> ()
| h::t -> map_snoc f x t
val map_rev : f:('a->Tot 'b) -> l:(list 'a) -> Lemma
(ensures (map f (rev l) == rev (map f l)))
let rec map_rev f l =
match l with
| [] -> ()
| h::t -> map_snoc f h (rev t); map_rev f t
(* Map for options *)
val option_map : ('a -> Tot 'b) -> option 'a -> Tot (option 'b)
let option_map f o =
match o with
| None -> None
| Some a -> Some (f a)
(* Fold *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 | f: (f: 'a -> _: 'b -> 'b) -> l: Prims.list 'a -> b: 'b -> 'b | Prims.Tot | [
"total"
] | [] | [
"Prims.list",
"SfPoly.fold"
] | [
"recursion"
] | false | false | false | true | false | let rec fold f l b =
| match l with
| [] -> b
| h :: t -> f h (fold f t b) | false |
Vale.Stdcalls.X64.Aes.fsti | Vale.Stdcalls.X64.Aes.key128_lemma' | val key128_lemma' (code: V.va_code) (_win: bool) (input_b output_b: b128) (va_s0: V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires key128_pre code input_b output_b va_s0)
(ensures
(fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
key128_post code input_b output_b va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer input_b) /\
ME.buffer_writeable (as_vale_buffer output_b))) | val key128_lemma' (code: V.va_code) (_win: bool) (input_b output_b: b128) (va_s0: V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires key128_pre code input_b output_b va_s0)
(ensures
(fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
key128_post code input_b output_b va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer input_b) /\
ME.buffer_writeable (as_vale_buffer output_b))) | let key128_lemma'
(code:V.va_code)
(_win:bool)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
key128_pre code input_b output_b va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
key128_post code input_b output_b va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer input_b) /\
ME.buffer_writeable (as_vale_buffer output_b)
)) =
let va_s1, f = AE.va_lemma_KeyExpansionStdcall code va_s0 IA.win AES_128
(as_vale_buffer input_b) (as_vale_buffer output_b) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 input_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 output_b;
(va_s1, f) | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.Aes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 13,
"end_line": 91,
"start_col": 0,
"start_line": 71
} | module Vale.Stdcalls.X64.Aes
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
open Vale.AES.AES_s
module AE = Vale.AES.X64.AES
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__] noextract
let dom: IX64.arity_ok_stdcall td =
let y = [t128_no_mod; t128_mod] in
assert_norm (List.length y = 2);
y
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let key128_pre : VSig.vale_pre dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state) ->
AE.va_req_KeyExpansionStdcall c va_s0 IA.win AES_128
(as_vale_buffer input_b) (as_vale_buffer output_b)
[@__reduce__] noextract
let key128_post : VSig.vale_post dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
AE.va_ens_KeyExpansionStdcall c va_s0 IA.win AES_128 (as_vale_buffer input_b) (as_vale_buffer output_b) va_s1 f
#set-options "--z3rlimit 20" | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.Aes.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.AES",
"short_module": "AE"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
code: Vale.X64.Decls.va_code ->
_win: Prims.bool ->
input_b: Vale.Stdcalls.X64.Aes.b128 ->
output_b: Vale.Stdcalls.X64.Aes.b128 ->
va_s0: Vale.X64.Decls.va_state
-> Prims.Ghost (Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) | Prims.Ghost | [] | [] | [
"Vale.X64.Decls.va_code",
"Prims.bool",
"Vale.Stdcalls.X64.Aes.b128",
"Vale.X64.Decls.va_state",
"Vale.X64.Decls.va_fuel",
"FStar.Pervasives.Native.Mktuple2",
"Prims.unit",
"Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal",
"Vale.Arch.HeapTypes_s.TUInt8",
"Vale.Arch.HeapTypes_s.TUInt128",
"FStar.Pervasives.Native.tuple2",
"Vale.X64.State.vale_state",
"Vale.AES.X64.AES.va_lemma_KeyExpansionStdcall",
"Vale.Interop.Assumptions.win",
"Vale.AES.AES_common_s.AES_128",
"Vale.X64.MemoryAdapters.as_vale_buffer",
"Vale.Stdcalls.X64.Aes.key128_pre",
"Prims.l_and",
"Vale.X64.Decls.eval_code",
"Vale.AsLowStar.ValeSig.vale_calling_conventions_stdcall",
"Vale.Stdcalls.X64.Aes.key128_post",
"Vale.X64.Memory.buffer_writeable"
] | [] | false | false | false | false | false | let key128_lemma' (code: V.va_code) (_win: bool) (input_b output_b: b128) (va_s0: V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires key128_pre code input_b output_b va_s0)
(ensures
(fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
key128_post code input_b output_b va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer input_b) /\
ME.buffer_writeable (as_vale_buffer output_b))) =
| let va_s1, f =
AE.va_lemma_KeyExpansionStdcall code
va_s0
IA.win
AES_128
(as_vale_buffer input_b)
(as_vale_buffer output_b)
in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 input_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 output_b;
(va_s1, f) | false |
SfPoly.fst | SfPoly.fold_length_named | val fold_length_named : l:list 'a -> Tot nat | val fold_length_named : l:list 'a -> Tot nat | let fold_length_named l = fold plus_one l 0 | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 43,
"end_line": 335,
"start_col": 0,
"start_line": 335
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *)
val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c
let prod_curry f x y = f (x,y)
val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c
let prod_uncurry f xy = f (fst xy) (snd xy)
val test_prod_uncurry: f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_uncurry f) (x, y) == f x y))
let test_prod_uncurry f x y = ()
val test_prod_curry: f:(('a * 'b)->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_curry f) x y == f (x, y)))
let test_prod_curry f x y = ()
val uncurry_curry : f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures (prod_curry (prod_uncurry f) x y == f x y))
let uncurry_curry f x y = ()
val curry_uncurry : f:(('a*'b)->Tot 'c) -> xy:('a*'b) -> Lemma
(ensures (prod_uncurry (prod_curry f) xy == f xy))
let curry_uncurry f xy = ()
(* Filter *)
val filter : test:('a->Tot bool) -> l:(list 'a) -> Tot (list 'a)
let rec filter test l =
match l with
| [] -> []
| h :: t -> if test h then h :: (filter test t)
else filter test t
val evenb : nat -> Tot bool
let evenb i = i%2 = 0
(* NS: Note: induction over non-inductive types like int is also fine *)
val evenb' : nat -> Tot bool
let rec evenb' i =
match i with
| 0 -> true
| 1 -> false
| _ -> evenb' (i-2)
val oddb : nat -> Tot bool
let oddb n = not (evenb n)
val test_filter1 : unit -> Lemma
(ensures (filter evenb [1;2;3;4] = [2;4]))
let test_filter1 () = ()
val test_filter2 : unit -> Lemma
(ensures (filter evenb' [1;2;3;4] = [2;4]))
let test_filter2 () = ()
(* Map *)
val map : ('a->Tot 'b) -> (list 'a) -> Tot (list 'b)
let rec map f l =
match l with
| [] -> []
| h :: t -> (f h) :: (map f t)
val test_map1 : unit -> Lemma
(ensures (map (fun n -> n + 3) [2;0;2] = [5;3;5]))
let test_map1 () = ()
val test_map2 : unit -> Lemma
(ensures (map oddb [2;1;2;5] = [false;true;false;true]))
let test_map2 () = ()
val test_map3 : unit -> Lemma
(ensures (map (fun n -> [evenb n;oddb n]) [2;1;2;5]
= [[true;false];[false;true];[true;false];[false;true]]))
let test_map3 () = ()
val map_snoc : f:('a->Tot 'b) -> x:'a -> l:list 'a -> Lemma
(ensures (map f (snoc l x) == snoc (map f l) (f x)))
let rec map_snoc f x l =
match l with
| [] -> ()
| h::t -> map_snoc f x t
val map_rev : f:('a->Tot 'b) -> l:(list 'a) -> Lemma
(ensures (map f (rev l) == rev (map f l)))
let rec map_rev f l =
match l with
| [] -> ()
| h::t -> map_snoc f h (rev t); map_rev f t
(* Map for options *)
val option_map : ('a -> Tot 'b) -> option 'a -> Tot (option 'b)
let option_map f o =
match o with
| None -> None
| Some a -> Some (f a)
(* Fold *)
val fold : (f : 'a -> 'b -> Tot 'b) -> list 'a -> 'b -> Tot 'b
let rec fold f l b =
match l with
| [] -> b
| h::t -> f h (fold f t b)
val fold_example1 : unit -> Lemma
(ensures (let open FStar.Mul in
fold (fun x y -> x * y) [1;2;3;4] 1 = 24))
let fold_example1 () = ()
val fold_example2 : unit -> Lemma
(ensures (fold (fun x y -> x && y) [true;true;false;true] true = false))
let fold_example2 () = ()
val fold_example3 : unit -> Lemma
(ensures (fold app [[1];[];[2;3];[4]] [] = [1;2;3;4]))
let fold_example3 () = ()
(* Functions For Constructing Functions *)
val constfun : 'a -> 'b -> Tot 'a
let constfun x _ = x
val ftrue : 'b -> Tot bool
(* This should work, but it doesn't: causes failed postconditions later on
let ftrue = constfun true *)
let ftrue _ = true
(* CH: This causes syntax error at character 12, is override a
keyword?
NS: Yes, override is a keyword. Only because it is a keyword in F#,
and since we (plan to) codegen to F# and Caml, unless we mangle
names, we inherit their keywords.
val override : ('a -> Tot 'b) -> 'a -> 'b -> 'a -> Tot 'b
*)
val my_override : #a:eqtype -> #b:Type -> (a -> Tot b) -> a -> b -> a -> Tot b
let my_override #a #b f k x k' = if k = k' then x else f k'
val fmostlytrue : int -> Tot bool
let fmostlytrue x = my_override (my_override ftrue 1 false) 3 false x
(* CH: these fail, too higher order? *)
(* NS: Not any more ... need to make currying explicit *)
(* CH: That's counter intuitive. I fail to see the
difference between implicit and explicit currying.
Isn't one just syntax sugar for the other? *)
val override_example1 : unit -> Lemma
(ensures (fmostlytrue 0 = true))
let override_example1 () = ()
val override_example2 : unit -> Lemma
(ensures (fmostlytrue 1 = false))
let override_example2 () = ()
val override_example3 : unit -> Lemma
(ensures (fmostlytrue 2 = true))
let override_example3 () = ()
val override_example4 : unit -> Lemma
(ensures (fmostlytrue 3 = false))
let override_example4 () = ()
val override_eq : #a:Type -> #b:eqtype -> x:a -> k:b -> f:(b->Tot a) -> Lemma
(ensures ((my_override f k x) k == x))
let override_eq #a #b x k f = ()
val override_neq : #a:Type -> #b:eqtype
-> x1:a -> x2:a -> k1:b -> k2:b -> f:(b->Tot a) -> Pure unit
(requires (f k1 == x1 /\ ~(k2 == k1)))
(ensures (fun r -> (my_override f k2 x2) k1 == x1))
let override_neq #a #b x1 x2 k1 k2 f = ()
(* NS: Experimenting first with named functions *)
val plus_one: 'a -> nat -> Tot nat
let plus_one m n = n + 1 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | l: Prims.list 'a -> Prims.nat | Prims.Tot | [
"total"
] | [] | [
"Prims.list",
"SfPoly.fold",
"Prims.nat",
"SfPoly.plus_one"
] | [] | false | false | false | true | false | let fold_length_named l =
| fold plus_one l 0 | false |
SfPoly.fst | SfPoly.map_rev | val map_rev : f:('a->Tot 'b) -> l:(list 'a) -> Lemma
(ensures (map f (rev l) == rev (map f l))) | val map_rev : f:('a->Tot 'b) -> l:(list 'a) -> Lemma
(ensures (map f (rev l) == rev (map f l))) | let rec map_rev f l =
match l with
| [] -> ()
| h::t -> map_snoc f h (rev t); map_rev f t | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 45,
"end_line": 242,
"start_col": 0,
"start_line": 239
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *)
val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c
let prod_curry f x y = f (x,y)
val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c
let prod_uncurry f xy = f (fst xy) (snd xy)
val test_prod_uncurry: f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_uncurry f) (x, y) == f x y))
let test_prod_uncurry f x y = ()
val test_prod_curry: f:(('a * 'b)->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_curry f) x y == f (x, y)))
let test_prod_curry f x y = ()
val uncurry_curry : f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures (prod_curry (prod_uncurry f) x y == f x y))
let uncurry_curry f x y = ()
val curry_uncurry : f:(('a*'b)->Tot 'c) -> xy:('a*'b) -> Lemma
(ensures (prod_uncurry (prod_curry f) xy == f xy))
let curry_uncurry f xy = ()
(* Filter *)
val filter : test:('a->Tot bool) -> l:(list 'a) -> Tot (list 'a)
let rec filter test l =
match l with
| [] -> []
| h :: t -> if test h then h :: (filter test t)
else filter test t
val evenb : nat -> Tot bool
let evenb i = i%2 = 0
(* NS: Note: induction over non-inductive types like int is also fine *)
val evenb' : nat -> Tot bool
let rec evenb' i =
match i with
| 0 -> true
| 1 -> false
| _ -> evenb' (i-2)
val oddb : nat -> Tot bool
let oddb n = not (evenb n)
val test_filter1 : unit -> Lemma
(ensures (filter evenb [1;2;3;4] = [2;4]))
let test_filter1 () = ()
val test_filter2 : unit -> Lemma
(ensures (filter evenb' [1;2;3;4] = [2;4]))
let test_filter2 () = ()
(* Map *)
val map : ('a->Tot 'b) -> (list 'a) -> Tot (list 'b)
let rec map f l =
match l with
| [] -> []
| h :: t -> (f h) :: (map f t)
val test_map1 : unit -> Lemma
(ensures (map (fun n -> n + 3) [2;0;2] = [5;3;5]))
let test_map1 () = ()
val test_map2 : unit -> Lemma
(ensures (map oddb [2;1;2;5] = [false;true;false;true]))
let test_map2 () = ()
val test_map3 : unit -> Lemma
(ensures (map (fun n -> [evenb n;oddb n]) [2;1;2;5]
= [[true;false];[false;true];[true;false];[false;true]]))
let test_map3 () = ()
val map_snoc : f:('a->Tot 'b) -> x:'a -> l:list 'a -> Lemma
(ensures (map f (snoc l x) == snoc (map f l) (f x)))
let rec map_snoc f x l =
match l with
| [] -> ()
| h::t -> map_snoc f x t
val map_rev : f:('a->Tot 'b) -> l:(list 'a) -> Lemma | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 | f: (_: 'a -> 'b) -> l: Prims.list 'a
-> FStar.Pervasives.Lemma (ensures SfPoly.map f (SfPoly.rev l) == SfPoly.rev (SfPoly.map f l)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.list",
"SfPoly.map_rev",
"Prims.unit",
"SfPoly.map_snoc",
"SfPoly.rev"
] | [
"recursion"
] | false | false | true | false | false | let rec map_rev f l =
| match l with
| [] -> ()
| h :: t ->
map_snoc f h (rev t);
map_rev f t | false |
SfPoly.fst | SfPoly.fcons | val fcons : ('a -> Tot 'b) -> 'a -> list 'b -> Tot (list 'b) | val fcons : ('a -> Tot 'b) -> 'a -> list 'b -> Tot (list 'b) | let fcons f x l = f x :: l | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 26,
"end_line": 347,
"start_col": 0,
"start_line": 347
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *)
val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c
let prod_curry f x y = f (x,y)
val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c
let prod_uncurry f xy = f (fst xy) (snd xy)
val test_prod_uncurry: f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_uncurry f) (x, y) == f x y))
let test_prod_uncurry f x y = ()
val test_prod_curry: f:(('a * 'b)->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_curry f) x y == f (x, y)))
let test_prod_curry f x y = ()
val uncurry_curry : f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures (prod_curry (prod_uncurry f) x y == f x y))
let uncurry_curry f x y = ()
val curry_uncurry : f:(('a*'b)->Tot 'c) -> xy:('a*'b) -> Lemma
(ensures (prod_uncurry (prod_curry f) xy == f xy))
let curry_uncurry f xy = ()
(* Filter *)
val filter : test:('a->Tot bool) -> l:(list 'a) -> Tot (list 'a)
let rec filter test l =
match l with
| [] -> []
| h :: t -> if test h then h :: (filter test t)
else filter test t
val evenb : nat -> Tot bool
let evenb i = i%2 = 0
(* NS: Note: induction over non-inductive types like int is also fine *)
val evenb' : nat -> Tot bool
let rec evenb' i =
match i with
| 0 -> true
| 1 -> false
| _ -> evenb' (i-2)
val oddb : nat -> Tot bool
let oddb n = not (evenb n)
val test_filter1 : unit -> Lemma
(ensures (filter evenb [1;2;3;4] = [2;4]))
let test_filter1 () = ()
val test_filter2 : unit -> Lemma
(ensures (filter evenb' [1;2;3;4] = [2;4]))
let test_filter2 () = ()
(* Map *)
val map : ('a->Tot 'b) -> (list 'a) -> Tot (list 'b)
let rec map f l =
match l with
| [] -> []
| h :: t -> (f h) :: (map f t)
val test_map1 : unit -> Lemma
(ensures (map (fun n -> n + 3) [2;0;2] = [5;3;5]))
let test_map1 () = ()
val test_map2 : unit -> Lemma
(ensures (map oddb [2;1;2;5] = [false;true;false;true]))
let test_map2 () = ()
val test_map3 : unit -> Lemma
(ensures (map (fun n -> [evenb n;oddb n]) [2;1;2;5]
= [[true;false];[false;true];[true;false];[false;true]]))
let test_map3 () = ()
val map_snoc : f:('a->Tot 'b) -> x:'a -> l:list 'a -> Lemma
(ensures (map f (snoc l x) == snoc (map f l) (f x)))
let rec map_snoc f x l =
match l with
| [] -> ()
| h::t -> map_snoc f x t
val map_rev : f:('a->Tot 'b) -> l:(list 'a) -> Lemma
(ensures (map f (rev l) == rev (map f l)))
let rec map_rev f l =
match l with
| [] -> ()
| h::t -> map_snoc f h (rev t); map_rev f t
(* Map for options *)
val option_map : ('a -> Tot 'b) -> option 'a -> Tot (option 'b)
let option_map f o =
match o with
| None -> None
| Some a -> Some (f a)
(* Fold *)
val fold : (f : 'a -> 'b -> Tot 'b) -> list 'a -> 'b -> Tot 'b
let rec fold f l b =
match l with
| [] -> b
| h::t -> f h (fold f t b)
val fold_example1 : unit -> Lemma
(ensures (let open FStar.Mul in
fold (fun x y -> x * y) [1;2;3;4] 1 = 24))
let fold_example1 () = ()
val fold_example2 : unit -> Lemma
(ensures (fold (fun x y -> x && y) [true;true;false;true] true = false))
let fold_example2 () = ()
val fold_example3 : unit -> Lemma
(ensures (fold app [[1];[];[2;3];[4]] [] = [1;2;3;4]))
let fold_example3 () = ()
(* Functions For Constructing Functions *)
val constfun : 'a -> 'b -> Tot 'a
let constfun x _ = x
val ftrue : 'b -> Tot bool
(* This should work, but it doesn't: causes failed postconditions later on
let ftrue = constfun true *)
let ftrue _ = true
(* CH: This causes syntax error at character 12, is override a
keyword?
NS: Yes, override is a keyword. Only because it is a keyword in F#,
and since we (plan to) codegen to F# and Caml, unless we mangle
names, we inherit their keywords.
val override : ('a -> Tot 'b) -> 'a -> 'b -> 'a -> Tot 'b
*)
val my_override : #a:eqtype -> #b:Type -> (a -> Tot b) -> a -> b -> a -> Tot b
let my_override #a #b f k x k' = if k = k' then x else f k'
val fmostlytrue : int -> Tot bool
let fmostlytrue x = my_override (my_override ftrue 1 false) 3 false x
(* CH: these fail, too higher order? *)
(* NS: Not any more ... need to make currying explicit *)
(* CH: That's counter intuitive. I fail to see the
difference between implicit and explicit currying.
Isn't one just syntax sugar for the other? *)
val override_example1 : unit -> Lemma
(ensures (fmostlytrue 0 = true))
let override_example1 () = ()
val override_example2 : unit -> Lemma
(ensures (fmostlytrue 1 = false))
let override_example2 () = ()
val override_example3 : unit -> Lemma
(ensures (fmostlytrue 2 = true))
let override_example3 () = ()
val override_example4 : unit -> Lemma
(ensures (fmostlytrue 3 = false))
let override_example4 () = ()
val override_eq : #a:Type -> #b:eqtype -> x:a -> k:b -> f:(b->Tot a) -> Lemma
(ensures ((my_override f k x) k == x))
let override_eq #a #b x k f = ()
val override_neq : #a:Type -> #b:eqtype
-> x1:a -> x2:a -> k1:b -> k2:b -> f:(b->Tot a) -> Pure unit
(requires (f k1 == x1 /\ ~(k2 == k1)))
(ensures (fun r -> (my_override f k2 x2) k1 == x1))
let override_neq #a #b x1 x2 k1 k2 f = ()
(* NS: Experimenting first with named functions *)
val plus_one: 'a -> nat -> Tot nat
let plus_one m n = n + 1
val fold_length_named : l:list 'a -> Tot nat
let fold_length_named l = fold plus_one l 0
val fold_length_named_correct : l:list 'a -> Lemma
(ensures (fold_length_named l = length l))
let rec fold_length_named_correct l =
match l with
| [] -> ()
| h::t -> fold_length_named_correct t
(* NS: But, with named functions, you have to explicitly closure-convert ...
and the closure arguments have to be explicitly curried ... yuck *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 | f: (_: 'a -> 'b) -> x: 'a -> l: Prims.list 'b -> Prims.list 'b | Prims.Tot | [
"total"
] | [] | [
"Prims.list",
"Prims.Cons"
] | [] | false | false | false | true | false | let fcons f x l =
| f x :: l | false |
SfPoly.fst | SfPoly.map_snoc | val map_snoc : f:('a->Tot 'b) -> x:'a -> l:list 'a -> Lemma
(ensures (map f (snoc l x) == snoc (map f l) (f x))) | val map_snoc : f:('a->Tot 'b) -> x:'a -> l:list 'a -> Lemma
(ensures (map f (snoc l x) == snoc (map f l) (f x))) | let rec map_snoc f x l =
match l with
| [] -> ()
| h::t -> map_snoc f x t | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 26,
"end_line": 235,
"start_col": 0,
"start_line": 232
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *)
val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c
let prod_curry f x y = f (x,y)
val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c
let prod_uncurry f xy = f (fst xy) (snd xy)
val test_prod_uncurry: f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_uncurry f) (x, y) == f x y))
let test_prod_uncurry f x y = ()
val test_prod_curry: f:(('a * 'b)->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_curry f) x y == f (x, y)))
let test_prod_curry f x y = ()
val uncurry_curry : f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures (prod_curry (prod_uncurry f) x y == f x y))
let uncurry_curry f x y = ()
val curry_uncurry : f:(('a*'b)->Tot 'c) -> xy:('a*'b) -> Lemma
(ensures (prod_uncurry (prod_curry f) xy == f xy))
let curry_uncurry f xy = ()
(* Filter *)
val filter : test:('a->Tot bool) -> l:(list 'a) -> Tot (list 'a)
let rec filter test l =
match l with
| [] -> []
| h :: t -> if test h then h :: (filter test t)
else filter test t
val evenb : nat -> Tot bool
let evenb i = i%2 = 0
(* NS: Note: induction over non-inductive types like int is also fine *)
val evenb' : nat -> Tot bool
let rec evenb' i =
match i with
| 0 -> true
| 1 -> false
| _ -> evenb' (i-2)
val oddb : nat -> Tot bool
let oddb n = not (evenb n)
val test_filter1 : unit -> Lemma
(ensures (filter evenb [1;2;3;4] = [2;4]))
let test_filter1 () = ()
val test_filter2 : unit -> Lemma
(ensures (filter evenb' [1;2;3;4] = [2;4]))
let test_filter2 () = ()
(* Map *)
val map : ('a->Tot 'b) -> (list 'a) -> Tot (list 'b)
let rec map f l =
match l with
| [] -> []
| h :: t -> (f h) :: (map f t)
val test_map1 : unit -> Lemma
(ensures (map (fun n -> n + 3) [2;0;2] = [5;3;5]))
let test_map1 () = ()
val test_map2 : unit -> Lemma
(ensures (map oddb [2;1;2;5] = [false;true;false;true]))
let test_map2 () = ()
val test_map3 : unit -> Lemma
(ensures (map (fun n -> [evenb n;oddb n]) [2;1;2;5]
= [[true;false];[false;true];[true;false];[false;true]]))
let test_map3 () = ()
val map_snoc : f:('a->Tot 'b) -> x:'a -> l:list 'a -> Lemma | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 | f: (_: 'a -> 'b) -> x: 'a -> l: Prims.list 'a
-> FStar.Pervasives.Lemma
(ensures SfPoly.map f (SfPoly.snoc l x) == SfPoly.snoc (SfPoly.map f l) (f x)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.list",
"SfPoly.map_snoc",
"Prims.unit"
] | [
"recursion"
] | false | false | true | false | false | let rec map_snoc f x l =
| match l with
| [] -> ()
| h :: t -> map_snoc f x t | false |
SfPoly.fst | SfPoly.fold_map_named | val fold_map_named : ('a->Tot 'b) -> list 'a -> Tot (list 'b) | val fold_map_named : ('a->Tot 'b) -> list 'a -> Tot (list 'b) | let fold_map_named f l= fold (fcons f) l [] | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 43,
"end_line": 350,
"start_col": 0,
"start_line": 350
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *)
val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c
let prod_curry f x y = f (x,y)
val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c
let prod_uncurry f xy = f (fst xy) (snd xy)
val test_prod_uncurry: f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_uncurry f) (x, y) == f x y))
let test_prod_uncurry f x y = ()
val test_prod_curry: f:(('a * 'b)->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_curry f) x y == f (x, y)))
let test_prod_curry f x y = ()
val uncurry_curry : f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures (prod_curry (prod_uncurry f) x y == f x y))
let uncurry_curry f x y = ()
val curry_uncurry : f:(('a*'b)->Tot 'c) -> xy:('a*'b) -> Lemma
(ensures (prod_uncurry (prod_curry f) xy == f xy))
let curry_uncurry f xy = ()
(* Filter *)
val filter : test:('a->Tot bool) -> l:(list 'a) -> Tot (list 'a)
let rec filter test l =
match l with
| [] -> []
| h :: t -> if test h then h :: (filter test t)
else filter test t
val evenb : nat -> Tot bool
let evenb i = i%2 = 0
(* NS: Note: induction over non-inductive types like int is also fine *)
val evenb' : nat -> Tot bool
let rec evenb' i =
match i with
| 0 -> true
| 1 -> false
| _ -> evenb' (i-2)
val oddb : nat -> Tot bool
let oddb n = not (evenb n)
val test_filter1 : unit -> Lemma
(ensures (filter evenb [1;2;3;4] = [2;4]))
let test_filter1 () = ()
val test_filter2 : unit -> Lemma
(ensures (filter evenb' [1;2;3;4] = [2;4]))
let test_filter2 () = ()
(* Map *)
val map : ('a->Tot 'b) -> (list 'a) -> Tot (list 'b)
let rec map f l =
match l with
| [] -> []
| h :: t -> (f h) :: (map f t)
val test_map1 : unit -> Lemma
(ensures (map (fun n -> n + 3) [2;0;2] = [5;3;5]))
let test_map1 () = ()
val test_map2 : unit -> Lemma
(ensures (map oddb [2;1;2;5] = [false;true;false;true]))
let test_map2 () = ()
val test_map3 : unit -> Lemma
(ensures (map (fun n -> [evenb n;oddb n]) [2;1;2;5]
= [[true;false];[false;true];[true;false];[false;true]]))
let test_map3 () = ()
val map_snoc : f:('a->Tot 'b) -> x:'a -> l:list 'a -> Lemma
(ensures (map f (snoc l x) == snoc (map f l) (f x)))
let rec map_snoc f x l =
match l with
| [] -> ()
| h::t -> map_snoc f x t
val map_rev : f:('a->Tot 'b) -> l:(list 'a) -> Lemma
(ensures (map f (rev l) == rev (map f l)))
let rec map_rev f l =
match l with
| [] -> ()
| h::t -> map_snoc f h (rev t); map_rev f t
(* Map for options *)
val option_map : ('a -> Tot 'b) -> option 'a -> Tot (option 'b)
let option_map f o =
match o with
| None -> None
| Some a -> Some (f a)
(* Fold *)
val fold : (f : 'a -> 'b -> Tot 'b) -> list 'a -> 'b -> Tot 'b
let rec fold f l b =
match l with
| [] -> b
| h::t -> f h (fold f t b)
val fold_example1 : unit -> Lemma
(ensures (let open FStar.Mul in
fold (fun x y -> x * y) [1;2;3;4] 1 = 24))
let fold_example1 () = ()
val fold_example2 : unit -> Lemma
(ensures (fold (fun x y -> x && y) [true;true;false;true] true = false))
let fold_example2 () = ()
val fold_example3 : unit -> Lemma
(ensures (fold app [[1];[];[2;3];[4]] [] = [1;2;3;4]))
let fold_example3 () = ()
(* Functions For Constructing Functions *)
val constfun : 'a -> 'b -> Tot 'a
let constfun x _ = x
val ftrue : 'b -> Tot bool
(* This should work, but it doesn't: causes failed postconditions later on
let ftrue = constfun true *)
let ftrue _ = true
(* CH: This causes syntax error at character 12, is override a
keyword?
NS: Yes, override is a keyword. Only because it is a keyword in F#,
and since we (plan to) codegen to F# and Caml, unless we mangle
names, we inherit their keywords.
val override : ('a -> Tot 'b) -> 'a -> 'b -> 'a -> Tot 'b
*)
val my_override : #a:eqtype -> #b:Type -> (a -> Tot b) -> a -> b -> a -> Tot b
let my_override #a #b f k x k' = if k = k' then x else f k'
val fmostlytrue : int -> Tot bool
let fmostlytrue x = my_override (my_override ftrue 1 false) 3 false x
(* CH: these fail, too higher order? *)
(* NS: Not any more ... need to make currying explicit *)
(* CH: That's counter intuitive. I fail to see the
difference between implicit and explicit currying.
Isn't one just syntax sugar for the other? *)
val override_example1 : unit -> Lemma
(ensures (fmostlytrue 0 = true))
let override_example1 () = ()
val override_example2 : unit -> Lemma
(ensures (fmostlytrue 1 = false))
let override_example2 () = ()
val override_example3 : unit -> Lemma
(ensures (fmostlytrue 2 = true))
let override_example3 () = ()
val override_example4 : unit -> Lemma
(ensures (fmostlytrue 3 = false))
let override_example4 () = ()
val override_eq : #a:Type -> #b:eqtype -> x:a -> k:b -> f:(b->Tot a) -> Lemma
(ensures ((my_override f k x) k == x))
let override_eq #a #b x k f = ()
val override_neq : #a:Type -> #b:eqtype
-> x1:a -> x2:a -> k1:b -> k2:b -> f:(b->Tot a) -> Pure unit
(requires (f k1 == x1 /\ ~(k2 == k1)))
(ensures (fun r -> (my_override f k2 x2) k1 == x1))
let override_neq #a #b x1 x2 k1 k2 f = ()
(* NS: Experimenting first with named functions *)
val plus_one: 'a -> nat -> Tot nat
let plus_one m n = n + 1
val fold_length_named : l:list 'a -> Tot nat
let fold_length_named l = fold plus_one l 0
val fold_length_named_correct : l:list 'a -> Lemma
(ensures (fold_length_named l = length l))
let rec fold_length_named_correct l =
match l with
| [] -> ()
| h::t -> fold_length_named_correct t
(* NS: But, with named functions, you have to explicitly closure-convert ...
and the closure arguments have to be explicitly curried ... yuck *)
val fcons : ('a -> Tot 'b) -> 'a -> list 'b -> Tot (list 'b)
let fcons f x l = f x :: l | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 | f: (_: 'a -> 'b) -> l: Prims.list 'a -> Prims.list 'b | Prims.Tot | [
"total"
] | [] | [
"Prims.list",
"SfPoly.fold",
"SfPoly.fcons",
"Prims.Nil"
] | [] | false | false | false | true | false | let fold_map_named f l =
| fold (fcons f) l [] | false |
SfPoly.fst | SfPoly.fold_map | val fold_map : ('a->Tot 'b) -> list 'a -> Tot (list 'b) | val fold_map : ('a->Tot 'b) -> list 'a -> Tot (list 'b) | let fold_map f l= fold (fun x l -> f x :: l) l [] | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 49,
"end_line": 374,
"start_col": 0,
"start_line": 374
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *)
val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c
let prod_curry f x y = f (x,y)
val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c
let prod_uncurry f xy = f (fst xy) (snd xy)
val test_prod_uncurry: f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_uncurry f) (x, y) == f x y))
let test_prod_uncurry f x y = ()
val test_prod_curry: f:(('a * 'b)->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_curry f) x y == f (x, y)))
let test_prod_curry f x y = ()
val uncurry_curry : f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures (prod_curry (prod_uncurry f) x y == f x y))
let uncurry_curry f x y = ()
val curry_uncurry : f:(('a*'b)->Tot 'c) -> xy:('a*'b) -> Lemma
(ensures (prod_uncurry (prod_curry f) xy == f xy))
let curry_uncurry f xy = ()
(* Filter *)
val filter : test:('a->Tot bool) -> l:(list 'a) -> Tot (list 'a)
let rec filter test l =
match l with
| [] -> []
| h :: t -> if test h then h :: (filter test t)
else filter test t
val evenb : nat -> Tot bool
let evenb i = i%2 = 0
(* NS: Note: induction over non-inductive types like int is also fine *)
val evenb' : nat -> Tot bool
let rec evenb' i =
match i with
| 0 -> true
| 1 -> false
| _ -> evenb' (i-2)
val oddb : nat -> Tot bool
let oddb n = not (evenb n)
val test_filter1 : unit -> Lemma
(ensures (filter evenb [1;2;3;4] = [2;4]))
let test_filter1 () = ()
val test_filter2 : unit -> Lemma
(ensures (filter evenb' [1;2;3;4] = [2;4]))
let test_filter2 () = ()
(* Map *)
val map : ('a->Tot 'b) -> (list 'a) -> Tot (list 'b)
let rec map f l =
match l with
| [] -> []
| h :: t -> (f h) :: (map f t)
val test_map1 : unit -> Lemma
(ensures (map (fun n -> n + 3) [2;0;2] = [5;3;5]))
let test_map1 () = ()
val test_map2 : unit -> Lemma
(ensures (map oddb [2;1;2;5] = [false;true;false;true]))
let test_map2 () = ()
val test_map3 : unit -> Lemma
(ensures (map (fun n -> [evenb n;oddb n]) [2;1;2;5]
= [[true;false];[false;true];[true;false];[false;true]]))
let test_map3 () = ()
val map_snoc : f:('a->Tot 'b) -> x:'a -> l:list 'a -> Lemma
(ensures (map f (snoc l x) == snoc (map f l) (f x)))
let rec map_snoc f x l =
match l with
| [] -> ()
| h::t -> map_snoc f x t
val map_rev : f:('a->Tot 'b) -> l:(list 'a) -> Lemma
(ensures (map f (rev l) == rev (map f l)))
let rec map_rev f l =
match l with
| [] -> ()
| h::t -> map_snoc f h (rev t); map_rev f t
(* Map for options *)
val option_map : ('a -> Tot 'b) -> option 'a -> Tot (option 'b)
let option_map f o =
match o with
| None -> None
| Some a -> Some (f a)
(* Fold *)
val fold : (f : 'a -> 'b -> Tot 'b) -> list 'a -> 'b -> Tot 'b
let rec fold f l b =
match l with
| [] -> b
| h::t -> f h (fold f t b)
val fold_example1 : unit -> Lemma
(ensures (let open FStar.Mul in
fold (fun x y -> x * y) [1;2;3;4] 1 = 24))
let fold_example1 () = ()
val fold_example2 : unit -> Lemma
(ensures (fold (fun x y -> x && y) [true;true;false;true] true = false))
let fold_example2 () = ()
val fold_example3 : unit -> Lemma
(ensures (fold app [[1];[];[2;3];[4]] [] = [1;2;3;4]))
let fold_example3 () = ()
(* Functions For Constructing Functions *)
val constfun : 'a -> 'b -> Tot 'a
let constfun x _ = x
val ftrue : 'b -> Tot bool
(* This should work, but it doesn't: causes failed postconditions later on
let ftrue = constfun true *)
let ftrue _ = true
(* CH: This causes syntax error at character 12, is override a
keyword?
NS: Yes, override is a keyword. Only because it is a keyword in F#,
and since we (plan to) codegen to F# and Caml, unless we mangle
names, we inherit their keywords.
val override : ('a -> Tot 'b) -> 'a -> 'b -> 'a -> Tot 'b
*)
val my_override : #a:eqtype -> #b:Type -> (a -> Tot b) -> a -> b -> a -> Tot b
let my_override #a #b f k x k' = if k = k' then x else f k'
val fmostlytrue : int -> Tot bool
let fmostlytrue x = my_override (my_override ftrue 1 false) 3 false x
(* CH: these fail, too higher order? *)
(* NS: Not any more ... need to make currying explicit *)
(* CH: That's counter intuitive. I fail to see the
difference between implicit and explicit currying.
Isn't one just syntax sugar for the other? *)
val override_example1 : unit -> Lemma
(ensures (fmostlytrue 0 = true))
let override_example1 () = ()
val override_example2 : unit -> Lemma
(ensures (fmostlytrue 1 = false))
let override_example2 () = ()
val override_example3 : unit -> Lemma
(ensures (fmostlytrue 2 = true))
let override_example3 () = ()
val override_example4 : unit -> Lemma
(ensures (fmostlytrue 3 = false))
let override_example4 () = ()
val override_eq : #a:Type -> #b:eqtype -> x:a -> k:b -> f:(b->Tot a) -> Lemma
(ensures ((my_override f k x) k == x))
let override_eq #a #b x k f = ()
val override_neq : #a:Type -> #b:eqtype
-> x1:a -> x2:a -> k1:b -> k2:b -> f:(b->Tot a) -> Pure unit
(requires (f k1 == x1 /\ ~(k2 == k1)))
(ensures (fun r -> (my_override f k2 x2) k1 == x1))
let override_neq #a #b x1 x2 k1 k2 f = ()
(* NS: Experimenting first with named functions *)
val plus_one: 'a -> nat -> Tot nat
let plus_one m n = n + 1
val fold_length_named : l:list 'a -> Tot nat
let fold_length_named l = fold plus_one l 0
val fold_length_named_correct : l:list 'a -> Lemma
(ensures (fold_length_named l = length l))
let rec fold_length_named_correct l =
match l with
| [] -> ()
| h::t -> fold_length_named_correct t
(* NS: But, with named functions, you have to explicitly closure-convert ...
and the closure arguments have to be explicitly curried ... yuck *)
val fcons : ('a -> Tot 'b) -> 'a -> list 'b -> Tot (list 'b)
let fcons f x l = f x :: l
val fold_map_named : ('a->Tot 'b) -> list 'a -> Tot (list 'b)
let fold_map_named f l= fold (fcons f) l []
(* But it works *)
val fold_map_named_correct : f:('a->Tot 'b) -> l:list 'a -> Lemma
(ensures (fold_map_named f l == map f l))
let rec fold_map_named_correct f l =
match l with
| [] -> ()
| h::t -> fold_map_named_correct f t
(* NS: So, let's do better with closures this time *)
(* NS: The lambda here is relatively easy, since it has no free variables *)
val fold_length : l:list 'a -> Tot nat
let fold_length l = fold (fun _ (n:nat) -> n + 1) l 0
val fold_length_correct : l:list 'a -> Lemma
(ensures (fold_length l = length l))
let rec fold_length_correct l =
match l with
| [] -> ()
| h::t -> fold_length_correct t
(* NS: This lambda is fancier, since it captures 'f' in its environment *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 | f: (_: 'a -> 'b) -> l: Prims.list 'a -> Prims.list 'b | Prims.Tot | [
"total"
] | [] | [
"Prims.list",
"SfPoly.fold",
"Prims.Cons",
"Prims.Nil"
] | [] | false | false | false | true | false | let fold_map f l =
| fold (fun x l -> f x :: l) l [] | false |
SfPoly.fst | SfPoly.option_map | val option_map : ('a -> Tot 'b) -> option 'a -> Tot (option 'b) | val option_map : ('a -> Tot 'b) -> option 'a -> Tot (option 'b) | let option_map f o =
match o with
| None -> None
| Some a -> Some (f a) | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 26,
"end_line": 250,
"start_col": 0,
"start_line": 247
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *)
val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c
let prod_curry f x y = f (x,y)
val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c
let prod_uncurry f xy = f (fst xy) (snd xy)
val test_prod_uncurry: f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_uncurry f) (x, y) == f x y))
let test_prod_uncurry f x y = ()
val test_prod_curry: f:(('a * 'b)->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_curry f) x y == f (x, y)))
let test_prod_curry f x y = ()
val uncurry_curry : f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures (prod_curry (prod_uncurry f) x y == f x y))
let uncurry_curry f x y = ()
val curry_uncurry : f:(('a*'b)->Tot 'c) -> xy:('a*'b) -> Lemma
(ensures (prod_uncurry (prod_curry f) xy == f xy))
let curry_uncurry f xy = ()
(* Filter *)
val filter : test:('a->Tot bool) -> l:(list 'a) -> Tot (list 'a)
let rec filter test l =
match l with
| [] -> []
| h :: t -> if test h then h :: (filter test t)
else filter test t
val evenb : nat -> Tot bool
let evenb i = i%2 = 0
(* NS: Note: induction over non-inductive types like int is also fine *)
val evenb' : nat -> Tot bool
let rec evenb' i =
match i with
| 0 -> true
| 1 -> false
| _ -> evenb' (i-2)
val oddb : nat -> Tot bool
let oddb n = not (evenb n)
val test_filter1 : unit -> Lemma
(ensures (filter evenb [1;2;3;4] = [2;4]))
let test_filter1 () = ()
val test_filter2 : unit -> Lemma
(ensures (filter evenb' [1;2;3;4] = [2;4]))
let test_filter2 () = ()
(* Map *)
val map : ('a->Tot 'b) -> (list 'a) -> Tot (list 'b)
let rec map f l =
match l with
| [] -> []
| h :: t -> (f h) :: (map f t)
val test_map1 : unit -> Lemma
(ensures (map (fun n -> n + 3) [2;0;2] = [5;3;5]))
let test_map1 () = ()
val test_map2 : unit -> Lemma
(ensures (map oddb [2;1;2;5] = [false;true;false;true]))
let test_map2 () = ()
val test_map3 : unit -> Lemma
(ensures (map (fun n -> [evenb n;oddb n]) [2;1;2;5]
= [[true;false];[false;true];[true;false];[false;true]]))
let test_map3 () = ()
val map_snoc : f:('a->Tot 'b) -> x:'a -> l:list 'a -> Lemma
(ensures (map f (snoc l x) == snoc (map f l) (f x)))
let rec map_snoc f x l =
match l with
| [] -> ()
| h::t -> map_snoc f x t
val map_rev : f:('a->Tot 'b) -> l:(list 'a) -> Lemma
(ensures (map f (rev l) == rev (map f l)))
let rec map_rev f l =
match l with
| [] -> ()
| h::t -> map_snoc f h (rev t); map_rev f t
(* Map for options *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 | f: (_: 'a -> 'b) -> o: FStar.Pervasives.Native.option 'a -> FStar.Pervasives.Native.option 'b | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.Native.option",
"FStar.Pervasives.Native.None",
"FStar.Pervasives.Native.Some"
] | [] | false | false | false | true | false | let option_map f o =
| match o with
| None -> None
| Some a -> Some (f a) | false |
SfPoly.fst | SfPoly.zero | val zero : ('a->'a) -> 'a -> 'a | val zero : ('a->'a) -> 'a -> 'a | let zero f x = x | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 16,
"end_line": 407,
"start_col": 0,
"start_line": 407
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *)
val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c
let prod_curry f x y = f (x,y)
val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c
let prod_uncurry f xy = f (fst xy) (snd xy)
val test_prod_uncurry: f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_uncurry f) (x, y) == f x y))
let test_prod_uncurry f x y = ()
val test_prod_curry: f:(('a * 'b)->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_curry f) x y == f (x, y)))
let test_prod_curry f x y = ()
val uncurry_curry : f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures (prod_curry (prod_uncurry f) x y == f x y))
let uncurry_curry f x y = ()
val curry_uncurry : f:(('a*'b)->Tot 'c) -> xy:('a*'b) -> Lemma
(ensures (prod_uncurry (prod_curry f) xy == f xy))
let curry_uncurry f xy = ()
(* Filter *)
val filter : test:('a->Tot bool) -> l:(list 'a) -> Tot (list 'a)
let rec filter test l =
match l with
| [] -> []
| h :: t -> if test h then h :: (filter test t)
else filter test t
val evenb : nat -> Tot bool
let evenb i = i%2 = 0
(* NS: Note: induction over non-inductive types like int is also fine *)
val evenb' : nat -> Tot bool
let rec evenb' i =
match i with
| 0 -> true
| 1 -> false
| _ -> evenb' (i-2)
val oddb : nat -> Tot bool
let oddb n = not (evenb n)
val test_filter1 : unit -> Lemma
(ensures (filter evenb [1;2;3;4] = [2;4]))
let test_filter1 () = ()
val test_filter2 : unit -> Lemma
(ensures (filter evenb' [1;2;3;4] = [2;4]))
let test_filter2 () = ()
(* Map *)
val map : ('a->Tot 'b) -> (list 'a) -> Tot (list 'b)
let rec map f l =
match l with
| [] -> []
| h :: t -> (f h) :: (map f t)
val test_map1 : unit -> Lemma
(ensures (map (fun n -> n + 3) [2;0;2] = [5;3;5]))
let test_map1 () = ()
val test_map2 : unit -> Lemma
(ensures (map oddb [2;1;2;5] = [false;true;false;true]))
let test_map2 () = ()
val test_map3 : unit -> Lemma
(ensures (map (fun n -> [evenb n;oddb n]) [2;1;2;5]
= [[true;false];[false;true];[true;false];[false;true]]))
let test_map3 () = ()
val map_snoc : f:('a->Tot 'b) -> x:'a -> l:list 'a -> Lemma
(ensures (map f (snoc l x) == snoc (map f l) (f x)))
let rec map_snoc f x l =
match l with
| [] -> ()
| h::t -> map_snoc f x t
val map_rev : f:('a->Tot 'b) -> l:(list 'a) -> Lemma
(ensures (map f (rev l) == rev (map f l)))
let rec map_rev f l =
match l with
| [] -> ()
| h::t -> map_snoc f h (rev t); map_rev f t
(* Map for options *)
val option_map : ('a -> Tot 'b) -> option 'a -> Tot (option 'b)
let option_map f o =
match o with
| None -> None
| Some a -> Some (f a)
(* Fold *)
val fold : (f : 'a -> 'b -> Tot 'b) -> list 'a -> 'b -> Tot 'b
let rec fold f l b =
match l with
| [] -> b
| h::t -> f h (fold f t b)
val fold_example1 : unit -> Lemma
(ensures (let open FStar.Mul in
fold (fun x y -> x * y) [1;2;3;4] 1 = 24))
let fold_example1 () = ()
val fold_example2 : unit -> Lemma
(ensures (fold (fun x y -> x && y) [true;true;false;true] true = false))
let fold_example2 () = ()
val fold_example3 : unit -> Lemma
(ensures (fold app [[1];[];[2;3];[4]] [] = [1;2;3;4]))
let fold_example3 () = ()
(* Functions For Constructing Functions *)
val constfun : 'a -> 'b -> Tot 'a
let constfun x _ = x
val ftrue : 'b -> Tot bool
(* This should work, but it doesn't: causes failed postconditions later on
let ftrue = constfun true *)
let ftrue _ = true
(* CH: This causes syntax error at character 12, is override a
keyword?
NS: Yes, override is a keyword. Only because it is a keyword in F#,
and since we (plan to) codegen to F# and Caml, unless we mangle
names, we inherit their keywords.
val override : ('a -> Tot 'b) -> 'a -> 'b -> 'a -> Tot 'b
*)
val my_override : #a:eqtype -> #b:Type -> (a -> Tot b) -> a -> b -> a -> Tot b
let my_override #a #b f k x k' = if k = k' then x else f k'
val fmostlytrue : int -> Tot bool
let fmostlytrue x = my_override (my_override ftrue 1 false) 3 false x
(* CH: these fail, too higher order? *)
(* NS: Not any more ... need to make currying explicit *)
(* CH: That's counter intuitive. I fail to see the
difference between implicit and explicit currying.
Isn't one just syntax sugar for the other? *)
val override_example1 : unit -> Lemma
(ensures (fmostlytrue 0 = true))
let override_example1 () = ()
val override_example2 : unit -> Lemma
(ensures (fmostlytrue 1 = false))
let override_example2 () = ()
val override_example3 : unit -> Lemma
(ensures (fmostlytrue 2 = true))
let override_example3 () = ()
val override_example4 : unit -> Lemma
(ensures (fmostlytrue 3 = false))
let override_example4 () = ()
val override_eq : #a:Type -> #b:eqtype -> x:a -> k:b -> f:(b->Tot a) -> Lemma
(ensures ((my_override f k x) k == x))
let override_eq #a #b x k f = ()
val override_neq : #a:Type -> #b:eqtype
-> x1:a -> x2:a -> k1:b -> k2:b -> f:(b->Tot a) -> Pure unit
(requires (f k1 == x1 /\ ~(k2 == k1)))
(ensures (fun r -> (my_override f k2 x2) k1 == x1))
let override_neq #a #b x1 x2 k1 k2 f = ()
(* NS: Experimenting first with named functions *)
val plus_one: 'a -> nat -> Tot nat
let plus_one m n = n + 1
val fold_length_named : l:list 'a -> Tot nat
let fold_length_named l = fold plus_one l 0
val fold_length_named_correct : l:list 'a -> Lemma
(ensures (fold_length_named l = length l))
let rec fold_length_named_correct l =
match l with
| [] -> ()
| h::t -> fold_length_named_correct t
(* NS: But, with named functions, you have to explicitly closure-convert ...
and the closure arguments have to be explicitly curried ... yuck *)
val fcons : ('a -> Tot 'b) -> 'a -> list 'b -> Tot (list 'b)
let fcons f x l = f x :: l
val fold_map_named : ('a->Tot 'b) -> list 'a -> Tot (list 'b)
let fold_map_named f l= fold (fcons f) l []
(* But it works *)
val fold_map_named_correct : f:('a->Tot 'b) -> l:list 'a -> Lemma
(ensures (fold_map_named f l == map f l))
let rec fold_map_named_correct f l =
match l with
| [] -> ()
| h::t -> fold_map_named_correct f t
(* NS: So, let's do better with closures this time *)
(* NS: The lambda here is relatively easy, since it has no free variables *)
val fold_length : l:list 'a -> Tot nat
let fold_length l = fold (fun _ (n:nat) -> n + 1) l 0
val fold_length_correct : l:list 'a -> Lemma
(ensures (fold_length l = length l))
let rec fold_length_correct l =
match l with
| [] -> ()
| h::t -> fold_length_correct t
(* NS: This lambda is fancier, since it captures 'f' in its environment *)
val fold_map : ('a->Tot 'b) -> list 'a -> Tot (list 'b)
let fold_map f l= fold (fun x l -> f x :: l) l []
val fold_map_correct : f:('a->Tot 'b) -> l:list 'a -> Lemma
(ensures (fold_map f l == map f l))
let rec fold_map_correct f l =
match l with
| [] -> ()
| h::t -> fold_map_correct f t
open FStar.List.Tot
val fold_right_cons_is_id: l:list 'a -> l':list 'a ->
Lemma (fold_right Cons l l' == (l @ l'))
let rec fold_right_cons_is_id l l' = match l with
| [] -> ()
| _::t -> fold_right_cons_is_id t l'
(* Church numerals *)
(* Using type abbreviation here does not work, even with full annotations
Problem seems similar to https://github.com/FStarLang/FStar/issues/15
and https://github.com/FStarLang/FStar/issues/23
type church 'a = ('a -> 'a) -> 'a -> 'a
val zero : church 'a
let zero ('a:Type) (f:'a->'a) (x:'a) = x
sf-poly.fst(371,0-373,3) : Error
Expected a term of type "('a:Type -> (church 'a))";
got a function "(fun 'a:Type f:('a -> 'a) x:'a -> x)"
*) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | f: (_: 'a -> 'a) -> x: 'a -> 'a | Prims.Tot | [
"total"
] | [] | [] | [] | false | false | false | true | false | let zero f x =
| x | false |
SfPoly.fst | SfPoly.two | val two : ('a->'a) -> 'a -> 'a | val two : ('a->'a) -> 'a -> 'a | let two f x = f (f x) | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 21,
"end_line": 413,
"start_col": 0,
"start_line": 413
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *)
val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c
let prod_curry f x y = f (x,y)
val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c
let prod_uncurry f xy = f (fst xy) (snd xy)
val test_prod_uncurry: f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_uncurry f) (x, y) == f x y))
let test_prod_uncurry f x y = ()
val test_prod_curry: f:(('a * 'b)->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_curry f) x y == f (x, y)))
let test_prod_curry f x y = ()
val uncurry_curry : f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures (prod_curry (prod_uncurry f) x y == f x y))
let uncurry_curry f x y = ()
val curry_uncurry : f:(('a*'b)->Tot 'c) -> xy:('a*'b) -> Lemma
(ensures (prod_uncurry (prod_curry f) xy == f xy))
let curry_uncurry f xy = ()
(* Filter *)
val filter : test:('a->Tot bool) -> l:(list 'a) -> Tot (list 'a)
let rec filter test l =
match l with
| [] -> []
| h :: t -> if test h then h :: (filter test t)
else filter test t
val evenb : nat -> Tot bool
let evenb i = i%2 = 0
(* NS: Note: induction over non-inductive types like int is also fine *)
val evenb' : nat -> Tot bool
let rec evenb' i =
match i with
| 0 -> true
| 1 -> false
| _ -> evenb' (i-2)
val oddb : nat -> Tot bool
let oddb n = not (evenb n)
val test_filter1 : unit -> Lemma
(ensures (filter evenb [1;2;3;4] = [2;4]))
let test_filter1 () = ()
val test_filter2 : unit -> Lemma
(ensures (filter evenb' [1;2;3;4] = [2;4]))
let test_filter2 () = ()
(* Map *)
val map : ('a->Tot 'b) -> (list 'a) -> Tot (list 'b)
let rec map f l =
match l with
| [] -> []
| h :: t -> (f h) :: (map f t)
val test_map1 : unit -> Lemma
(ensures (map (fun n -> n + 3) [2;0;2] = [5;3;5]))
let test_map1 () = ()
val test_map2 : unit -> Lemma
(ensures (map oddb [2;1;2;5] = [false;true;false;true]))
let test_map2 () = ()
val test_map3 : unit -> Lemma
(ensures (map (fun n -> [evenb n;oddb n]) [2;1;2;5]
= [[true;false];[false;true];[true;false];[false;true]]))
let test_map3 () = ()
val map_snoc : f:('a->Tot 'b) -> x:'a -> l:list 'a -> Lemma
(ensures (map f (snoc l x) == snoc (map f l) (f x)))
let rec map_snoc f x l =
match l with
| [] -> ()
| h::t -> map_snoc f x t
val map_rev : f:('a->Tot 'b) -> l:(list 'a) -> Lemma
(ensures (map f (rev l) == rev (map f l)))
let rec map_rev f l =
match l with
| [] -> ()
| h::t -> map_snoc f h (rev t); map_rev f t
(* Map for options *)
val option_map : ('a -> Tot 'b) -> option 'a -> Tot (option 'b)
let option_map f o =
match o with
| None -> None
| Some a -> Some (f a)
(* Fold *)
val fold : (f : 'a -> 'b -> Tot 'b) -> list 'a -> 'b -> Tot 'b
let rec fold f l b =
match l with
| [] -> b
| h::t -> f h (fold f t b)
val fold_example1 : unit -> Lemma
(ensures (let open FStar.Mul in
fold (fun x y -> x * y) [1;2;3;4] 1 = 24))
let fold_example1 () = ()
val fold_example2 : unit -> Lemma
(ensures (fold (fun x y -> x && y) [true;true;false;true] true = false))
let fold_example2 () = ()
val fold_example3 : unit -> Lemma
(ensures (fold app [[1];[];[2;3];[4]] [] = [1;2;3;4]))
let fold_example3 () = ()
(* Functions For Constructing Functions *)
val constfun : 'a -> 'b -> Tot 'a
let constfun x _ = x
val ftrue : 'b -> Tot bool
(* This should work, but it doesn't: causes failed postconditions later on
let ftrue = constfun true *)
let ftrue _ = true
(* CH: This causes syntax error at character 12, is override a
keyword?
NS: Yes, override is a keyword. Only because it is a keyword in F#,
and since we (plan to) codegen to F# and Caml, unless we mangle
names, we inherit their keywords.
val override : ('a -> Tot 'b) -> 'a -> 'b -> 'a -> Tot 'b
*)
val my_override : #a:eqtype -> #b:Type -> (a -> Tot b) -> a -> b -> a -> Tot b
let my_override #a #b f k x k' = if k = k' then x else f k'
val fmostlytrue : int -> Tot bool
let fmostlytrue x = my_override (my_override ftrue 1 false) 3 false x
(* CH: these fail, too higher order? *)
(* NS: Not any more ... need to make currying explicit *)
(* CH: That's counter intuitive. I fail to see the
difference between implicit and explicit currying.
Isn't one just syntax sugar for the other? *)
val override_example1 : unit -> Lemma
(ensures (fmostlytrue 0 = true))
let override_example1 () = ()
val override_example2 : unit -> Lemma
(ensures (fmostlytrue 1 = false))
let override_example2 () = ()
val override_example3 : unit -> Lemma
(ensures (fmostlytrue 2 = true))
let override_example3 () = ()
val override_example4 : unit -> Lemma
(ensures (fmostlytrue 3 = false))
let override_example4 () = ()
val override_eq : #a:Type -> #b:eqtype -> x:a -> k:b -> f:(b->Tot a) -> Lemma
(ensures ((my_override f k x) k == x))
let override_eq #a #b x k f = ()
val override_neq : #a:Type -> #b:eqtype
-> x1:a -> x2:a -> k1:b -> k2:b -> f:(b->Tot a) -> Pure unit
(requires (f k1 == x1 /\ ~(k2 == k1)))
(ensures (fun r -> (my_override f k2 x2) k1 == x1))
let override_neq #a #b x1 x2 k1 k2 f = ()
(* NS: Experimenting first with named functions *)
val plus_one: 'a -> nat -> Tot nat
let plus_one m n = n + 1
val fold_length_named : l:list 'a -> Tot nat
let fold_length_named l = fold plus_one l 0
val fold_length_named_correct : l:list 'a -> Lemma
(ensures (fold_length_named l = length l))
let rec fold_length_named_correct l =
match l with
| [] -> ()
| h::t -> fold_length_named_correct t
(* NS: But, with named functions, you have to explicitly closure-convert ...
and the closure arguments have to be explicitly curried ... yuck *)
val fcons : ('a -> Tot 'b) -> 'a -> list 'b -> Tot (list 'b)
let fcons f x l = f x :: l
val fold_map_named : ('a->Tot 'b) -> list 'a -> Tot (list 'b)
let fold_map_named f l= fold (fcons f) l []
(* But it works *)
val fold_map_named_correct : f:('a->Tot 'b) -> l:list 'a -> Lemma
(ensures (fold_map_named f l == map f l))
let rec fold_map_named_correct f l =
match l with
| [] -> ()
| h::t -> fold_map_named_correct f t
(* NS: So, let's do better with closures this time *)
(* NS: The lambda here is relatively easy, since it has no free variables *)
val fold_length : l:list 'a -> Tot nat
let fold_length l = fold (fun _ (n:nat) -> n + 1) l 0
val fold_length_correct : l:list 'a -> Lemma
(ensures (fold_length l = length l))
let rec fold_length_correct l =
match l with
| [] -> ()
| h::t -> fold_length_correct t
(* NS: This lambda is fancier, since it captures 'f' in its environment *)
val fold_map : ('a->Tot 'b) -> list 'a -> Tot (list 'b)
let fold_map f l= fold (fun x l -> f x :: l) l []
val fold_map_correct : f:('a->Tot 'b) -> l:list 'a -> Lemma
(ensures (fold_map f l == map f l))
let rec fold_map_correct f l =
match l with
| [] -> ()
| h::t -> fold_map_correct f t
open FStar.List.Tot
val fold_right_cons_is_id: l:list 'a -> l':list 'a ->
Lemma (fold_right Cons l l' == (l @ l'))
let rec fold_right_cons_is_id l l' = match l with
| [] -> ()
| _::t -> fold_right_cons_is_id t l'
(* Church numerals *)
(* Using type abbreviation here does not work, even with full annotations
Problem seems similar to https://github.com/FStarLang/FStar/issues/15
and https://github.com/FStarLang/FStar/issues/23
type church 'a = ('a -> 'a) -> 'a -> 'a
val zero : church 'a
let zero ('a:Type) (f:'a->'a) (x:'a) = x
sf-poly.fst(371,0-373,3) : Error
Expected a term of type "('a:Type -> (church 'a))";
got a function "(fun 'a:Type f:('a -> 'a) x:'a -> x)"
*)
val zero : ('a->'a) -> 'a -> 'a
let zero f x = x
val one : ('a->'a) -> 'a -> 'a
let one f x = f x | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | f: (_: 'a -> 'a) -> x: 'a -> 'a | Prims.Tot | [
"total"
] | [] | [] | [] | false | false | false | true | false | let two f x =
| f (f x) | false |
Vale.Stdcalls.X64.Aes.fsti | Vale.Stdcalls.X64.Aes.key256_lemma' | val key256_lemma' (code: V.va_code) (_win: bool) (input_b output_b: b128) (va_s0: V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires key256_pre code input_b output_b va_s0)
(ensures
(fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
key256_post code input_b output_b va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer input_b) /\
ME.buffer_writeable (as_vale_buffer output_b))) | val key256_lemma' (code: V.va_code) (_win: bool) (input_b output_b: b128) (va_s0: V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires key256_pre code input_b output_b va_s0)
(ensures
(fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
key256_post code input_b output_b va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer input_b) /\
ME.buffer_writeable (as_vale_buffer output_b))) | let key256_lemma'
(code:V.va_code)
(_win:bool)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
key256_pre code input_b output_b va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
key256_post code input_b output_b va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer input_b) /\
ME.buffer_writeable (as_vale_buffer output_b)
)) =
let va_s1, f = AE.va_lemma_KeyExpansionStdcall code va_s0 IA.win AES_256
(as_vale_buffer input_b) (as_vale_buffer output_b) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 input_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 output_b;
(va_s1, f) | {
"file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.Aes.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 13,
"end_line": 154,
"start_col": 0,
"start_line": 134
} | module Vale.Stdcalls.X64.Aes
open FStar.HyperStack.ST
module B = LowStar.Buffer
module HS = FStar.HyperStack
open FStar.Mul
module DV = LowStar.BufferView.Down
module UV = LowStar.BufferView.Up
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
open Vale.AES.AES_s
module AE = Vale.AES.X64.AES
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
noextract
let as_t (#a:Type) (x:normal a) : a = x
noextract
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__] noextract
let b128 = buf_t TUInt8 TUInt128
[@__reduce__] noextract
let t128_mod = TD_Buffer TUInt8 TUInt128 default_bq
[@__reduce__] noextract
let t128_no_mod = TD_Buffer TUInt8 TUInt128 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__] noextract
let dom: IX64.arity_ok_stdcall td =
let y = [t128_no_mod; t128_mod] in
assert_norm (List.length y = 2);
y
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let key128_pre : VSig.vale_pre dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state) ->
AE.va_req_KeyExpansionStdcall c va_s0 IA.win AES_128
(as_vale_buffer input_b) (as_vale_buffer output_b)
[@__reduce__] noextract
let key128_post : VSig.vale_post dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
AE.va_ens_KeyExpansionStdcall c va_s0 IA.win AES_128 (as_vale_buffer input_b) (as_vale_buffer output_b) va_s1 f
#set-options "--z3rlimit 20"
[@__reduce__] noextract
let key128_lemma'
(code:V.va_code)
(_win:bool)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
key128_pre code input_b output_b va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
key128_post code input_b output_b va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer input_b) /\
ME.buffer_writeable (as_vale_buffer output_b)
)) =
let va_s1, f = AE.va_lemma_KeyExpansionStdcall code va_s0 IA.win AES_128
(as_vale_buffer input_b) (as_vale_buffer output_b) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 input_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 output_b;
(va_s1, f)
noextract
let key128_lemma = as_t #(VSig.vale_sig_stdcall key128_pre key128_post) key128_lemma'
noextract
let code_key128 = AE.va_code_KeyExpansionStdcall IA.win AES_128
[@__reduce__] noextract
let lowstar_key128_t =
assert_norm (List.length dom + List.length ([]<:list arg) <= 4);
IX64.as_lowstar_sig_t_weak_stdcall
code_key128
dom
[]
_
_
(W.mk_prediction code_key128 dom [] (key128_lemma code_key128 IA.win))
(* Need to rearrange the order of arguments *)
[@__reduce__] noextract
let key256_pre : VSig.vale_pre dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state) ->
AE.va_req_KeyExpansionStdcall c va_s0 IA.win AES_256
(as_vale_buffer input_b) (as_vale_buffer output_b)
[@__reduce__] noextract
let key256_post : VSig.vale_post dom =
fun (c:V.va_code)
(input_b:b128)
(output_b:b128)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
AE.va_ens_KeyExpansionStdcall c va_s0 IA.win AES_256 (as_vale_buffer input_b) (as_vale_buffer output_b) va_s1 f
#set-options "--z3rlimit 20" | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Up.fsti.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Vale.Stdcalls.X64.Aes.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.AES.X64.AES",
"short_module": "AE"
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Up",
"short_module": "UV"
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Stdcalls.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
code: Vale.X64.Decls.va_code ->
_win: Prims.bool ->
input_b: Vale.Stdcalls.X64.Aes.b128 ->
output_b: Vale.Stdcalls.X64.Aes.b128 ->
va_s0: Vale.X64.Decls.va_state
-> Prims.Ghost (Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) | Prims.Ghost | [] | [] | [
"Vale.X64.Decls.va_code",
"Prims.bool",
"Vale.Stdcalls.X64.Aes.b128",
"Vale.X64.Decls.va_state",
"Vale.X64.Decls.va_fuel",
"FStar.Pervasives.Native.Mktuple2",
"Prims.unit",
"Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal",
"Vale.Arch.HeapTypes_s.TUInt8",
"Vale.Arch.HeapTypes_s.TUInt128",
"FStar.Pervasives.Native.tuple2",
"Vale.X64.State.vale_state",
"Vale.AES.X64.AES.va_lemma_KeyExpansionStdcall",
"Vale.Interop.Assumptions.win",
"Vale.AES.AES_common_s.AES_256",
"Vale.X64.MemoryAdapters.as_vale_buffer",
"Vale.Stdcalls.X64.Aes.key256_pre",
"Prims.l_and",
"Vale.X64.Decls.eval_code",
"Vale.AsLowStar.ValeSig.vale_calling_conventions_stdcall",
"Vale.Stdcalls.X64.Aes.key256_post",
"Vale.X64.Memory.buffer_writeable"
] | [] | false | false | false | false | false | let key256_lemma' (code: V.va_code) (_win: bool) (input_b output_b: b128) (va_s0: V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires key256_pre code input_b output_b va_s0)
(ensures
(fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\
key256_post code input_b output_b va_s0 va_s1 f /\
ME.buffer_writeable (as_vale_buffer input_b) /\
ME.buffer_writeable (as_vale_buffer output_b))) =
| let va_s1, f =
AE.va_lemma_KeyExpansionStdcall code
va_s0
IA.win
AES_256
(as_vale_buffer input_b)
(as_vale_buffer output_b)
in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 input_b;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 output_b;
(va_s1, f) | false |
SfPoly.fst | SfPoly.plus | val plus : (('a->'a) -> 'a -> 'a) -> (('a->'a) -> 'a -> 'a) -> ('a->'a) -> 'a -> 'a | val plus : (('a->'a) -> 'a -> 'a) -> (('a->'a) -> 'a -> 'a) -> ('a->'a) -> 'a -> 'a | let plus n m f x = n f (m f x) | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 30,
"end_line": 419,
"start_col": 0,
"start_line": 419
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *)
val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c
let prod_curry f x y = f (x,y)
val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c
let prod_uncurry f xy = f (fst xy) (snd xy)
val test_prod_uncurry: f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_uncurry f) (x, y) == f x y))
let test_prod_uncurry f x y = ()
val test_prod_curry: f:(('a * 'b)->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_curry f) x y == f (x, y)))
let test_prod_curry f x y = ()
val uncurry_curry : f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures (prod_curry (prod_uncurry f) x y == f x y))
let uncurry_curry f x y = ()
val curry_uncurry : f:(('a*'b)->Tot 'c) -> xy:('a*'b) -> Lemma
(ensures (prod_uncurry (prod_curry f) xy == f xy))
let curry_uncurry f xy = ()
(* Filter *)
val filter : test:('a->Tot bool) -> l:(list 'a) -> Tot (list 'a)
let rec filter test l =
match l with
| [] -> []
| h :: t -> if test h then h :: (filter test t)
else filter test t
val evenb : nat -> Tot bool
let evenb i = i%2 = 0
(* NS: Note: induction over non-inductive types like int is also fine *)
val evenb' : nat -> Tot bool
let rec evenb' i =
match i with
| 0 -> true
| 1 -> false
| _ -> evenb' (i-2)
val oddb : nat -> Tot bool
let oddb n = not (evenb n)
val test_filter1 : unit -> Lemma
(ensures (filter evenb [1;2;3;4] = [2;4]))
let test_filter1 () = ()
val test_filter2 : unit -> Lemma
(ensures (filter evenb' [1;2;3;4] = [2;4]))
let test_filter2 () = ()
(* Map *)
val map : ('a->Tot 'b) -> (list 'a) -> Tot (list 'b)
let rec map f l =
match l with
| [] -> []
| h :: t -> (f h) :: (map f t)
val test_map1 : unit -> Lemma
(ensures (map (fun n -> n + 3) [2;0;2] = [5;3;5]))
let test_map1 () = ()
val test_map2 : unit -> Lemma
(ensures (map oddb [2;1;2;5] = [false;true;false;true]))
let test_map2 () = ()
val test_map3 : unit -> Lemma
(ensures (map (fun n -> [evenb n;oddb n]) [2;1;2;5]
= [[true;false];[false;true];[true;false];[false;true]]))
let test_map3 () = ()
val map_snoc : f:('a->Tot 'b) -> x:'a -> l:list 'a -> Lemma
(ensures (map f (snoc l x) == snoc (map f l) (f x)))
let rec map_snoc f x l =
match l with
| [] -> ()
| h::t -> map_snoc f x t
val map_rev : f:('a->Tot 'b) -> l:(list 'a) -> Lemma
(ensures (map f (rev l) == rev (map f l)))
let rec map_rev f l =
match l with
| [] -> ()
| h::t -> map_snoc f h (rev t); map_rev f t
(* Map for options *)
val option_map : ('a -> Tot 'b) -> option 'a -> Tot (option 'b)
let option_map f o =
match o with
| None -> None
| Some a -> Some (f a)
(* Fold *)
val fold : (f : 'a -> 'b -> Tot 'b) -> list 'a -> 'b -> Tot 'b
let rec fold f l b =
match l with
| [] -> b
| h::t -> f h (fold f t b)
val fold_example1 : unit -> Lemma
(ensures (let open FStar.Mul in
fold (fun x y -> x * y) [1;2;3;4] 1 = 24))
let fold_example1 () = ()
val fold_example2 : unit -> Lemma
(ensures (fold (fun x y -> x && y) [true;true;false;true] true = false))
let fold_example2 () = ()
val fold_example3 : unit -> Lemma
(ensures (fold app [[1];[];[2;3];[4]] [] = [1;2;3;4]))
let fold_example3 () = ()
(* Functions For Constructing Functions *)
val constfun : 'a -> 'b -> Tot 'a
let constfun x _ = x
val ftrue : 'b -> Tot bool
(* This should work, but it doesn't: causes failed postconditions later on
let ftrue = constfun true *)
let ftrue _ = true
(* CH: This causes syntax error at character 12, is override a
keyword?
NS: Yes, override is a keyword. Only because it is a keyword in F#,
and since we (plan to) codegen to F# and Caml, unless we mangle
names, we inherit their keywords.
val override : ('a -> Tot 'b) -> 'a -> 'b -> 'a -> Tot 'b
*)
val my_override : #a:eqtype -> #b:Type -> (a -> Tot b) -> a -> b -> a -> Tot b
let my_override #a #b f k x k' = if k = k' then x else f k'
val fmostlytrue : int -> Tot bool
let fmostlytrue x = my_override (my_override ftrue 1 false) 3 false x
(* CH: these fail, too higher order? *)
(* NS: Not any more ... need to make currying explicit *)
(* CH: That's counter intuitive. I fail to see the
difference between implicit and explicit currying.
Isn't one just syntax sugar for the other? *)
val override_example1 : unit -> Lemma
(ensures (fmostlytrue 0 = true))
let override_example1 () = ()
val override_example2 : unit -> Lemma
(ensures (fmostlytrue 1 = false))
let override_example2 () = ()
val override_example3 : unit -> Lemma
(ensures (fmostlytrue 2 = true))
let override_example3 () = ()
val override_example4 : unit -> Lemma
(ensures (fmostlytrue 3 = false))
let override_example4 () = ()
val override_eq : #a:Type -> #b:eqtype -> x:a -> k:b -> f:(b->Tot a) -> Lemma
(ensures ((my_override f k x) k == x))
let override_eq #a #b x k f = ()
val override_neq : #a:Type -> #b:eqtype
-> x1:a -> x2:a -> k1:b -> k2:b -> f:(b->Tot a) -> Pure unit
(requires (f k1 == x1 /\ ~(k2 == k1)))
(ensures (fun r -> (my_override f k2 x2) k1 == x1))
let override_neq #a #b x1 x2 k1 k2 f = ()
(* NS: Experimenting first with named functions *)
val plus_one: 'a -> nat -> Tot nat
let plus_one m n = n + 1
val fold_length_named : l:list 'a -> Tot nat
let fold_length_named l = fold plus_one l 0
val fold_length_named_correct : l:list 'a -> Lemma
(ensures (fold_length_named l = length l))
let rec fold_length_named_correct l =
match l with
| [] -> ()
| h::t -> fold_length_named_correct t
(* NS: But, with named functions, you have to explicitly closure-convert ...
and the closure arguments have to be explicitly curried ... yuck *)
val fcons : ('a -> Tot 'b) -> 'a -> list 'b -> Tot (list 'b)
let fcons f x l = f x :: l
val fold_map_named : ('a->Tot 'b) -> list 'a -> Tot (list 'b)
let fold_map_named f l= fold (fcons f) l []
(* But it works *)
val fold_map_named_correct : f:('a->Tot 'b) -> l:list 'a -> Lemma
(ensures (fold_map_named f l == map f l))
let rec fold_map_named_correct f l =
match l with
| [] -> ()
| h::t -> fold_map_named_correct f t
(* NS: So, let's do better with closures this time *)
(* NS: The lambda here is relatively easy, since it has no free variables *)
val fold_length : l:list 'a -> Tot nat
let fold_length l = fold (fun _ (n:nat) -> n + 1) l 0
val fold_length_correct : l:list 'a -> Lemma
(ensures (fold_length l = length l))
let rec fold_length_correct l =
match l with
| [] -> ()
| h::t -> fold_length_correct t
(* NS: This lambda is fancier, since it captures 'f' in its environment *)
val fold_map : ('a->Tot 'b) -> list 'a -> Tot (list 'b)
let fold_map f l= fold (fun x l -> f x :: l) l []
val fold_map_correct : f:('a->Tot 'b) -> l:list 'a -> Lemma
(ensures (fold_map f l == map f l))
let rec fold_map_correct f l =
match l with
| [] -> ()
| h::t -> fold_map_correct f t
open FStar.List.Tot
val fold_right_cons_is_id: l:list 'a -> l':list 'a ->
Lemma (fold_right Cons l l' == (l @ l'))
let rec fold_right_cons_is_id l l' = match l with
| [] -> ()
| _::t -> fold_right_cons_is_id t l'
(* Church numerals *)
(* Using type abbreviation here does not work, even with full annotations
Problem seems similar to https://github.com/FStarLang/FStar/issues/15
and https://github.com/FStarLang/FStar/issues/23
type church 'a = ('a -> 'a) -> 'a -> 'a
val zero : church 'a
let zero ('a:Type) (f:'a->'a) (x:'a) = x
sf-poly.fst(371,0-373,3) : Error
Expected a term of type "('a:Type -> (church 'a))";
got a function "(fun 'a:Type f:('a -> 'a) x:'a -> x)"
*)
val zero : ('a->'a) -> 'a -> 'a
let zero f x = x
val one : ('a->'a) -> 'a -> 'a
let one f x = f x
val two : ('a->'a) -> 'a -> 'a
let two f x = f (f x)
val succ : (('a->'a) -> 'a -> 'a) -> ('a->'a) -> 'a -> 'a
let succ n f x = f (n f x) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 |
n: (_: (_: 'a -> 'a) -> _: 'a -> 'a) ->
m: (_: (_: 'a -> 'a) -> _: 'a -> 'a) ->
f: (_: 'a -> 'a) ->
x: 'a
-> 'a | Prims.Tot | [
"total"
] | [] | [] | [] | false | false | false | true | false | let plus n m f x =
| n f (m f x) | false |
SfPoly.fst | SfPoly.mult | val mult : (('a->'a) -> 'a -> 'a) -> (('a->'a) -> 'a -> 'a) -> ('a->'a) -> 'a -> 'a | val mult : (('a->'a) -> 'a -> 'a) -> (('a->'a) -> 'a -> 'a) -> ('a->'a) -> 'a -> 'a | let mult n m f x = n (m f) x | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 28,
"end_line": 422,
"start_col": 0,
"start_line": 422
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *)
val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c
let prod_curry f x y = f (x,y)
val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c
let prod_uncurry f xy = f (fst xy) (snd xy)
val test_prod_uncurry: f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_uncurry f) (x, y) == f x y))
let test_prod_uncurry f x y = ()
val test_prod_curry: f:(('a * 'b)->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_curry f) x y == f (x, y)))
let test_prod_curry f x y = ()
val uncurry_curry : f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures (prod_curry (prod_uncurry f) x y == f x y))
let uncurry_curry f x y = ()
val curry_uncurry : f:(('a*'b)->Tot 'c) -> xy:('a*'b) -> Lemma
(ensures (prod_uncurry (prod_curry f) xy == f xy))
let curry_uncurry f xy = ()
(* Filter *)
val filter : test:('a->Tot bool) -> l:(list 'a) -> Tot (list 'a)
let rec filter test l =
match l with
| [] -> []
| h :: t -> if test h then h :: (filter test t)
else filter test t
val evenb : nat -> Tot bool
let evenb i = i%2 = 0
(* NS: Note: induction over non-inductive types like int is also fine *)
val evenb' : nat -> Tot bool
let rec evenb' i =
match i with
| 0 -> true
| 1 -> false
| _ -> evenb' (i-2)
val oddb : nat -> Tot bool
let oddb n = not (evenb n)
val test_filter1 : unit -> Lemma
(ensures (filter evenb [1;2;3;4] = [2;4]))
let test_filter1 () = ()
val test_filter2 : unit -> Lemma
(ensures (filter evenb' [1;2;3;4] = [2;4]))
let test_filter2 () = ()
(* Map *)
val map : ('a->Tot 'b) -> (list 'a) -> Tot (list 'b)
let rec map f l =
match l with
| [] -> []
| h :: t -> (f h) :: (map f t)
val test_map1 : unit -> Lemma
(ensures (map (fun n -> n + 3) [2;0;2] = [5;3;5]))
let test_map1 () = ()
val test_map2 : unit -> Lemma
(ensures (map oddb [2;1;2;5] = [false;true;false;true]))
let test_map2 () = ()
val test_map3 : unit -> Lemma
(ensures (map (fun n -> [evenb n;oddb n]) [2;1;2;5]
= [[true;false];[false;true];[true;false];[false;true]]))
let test_map3 () = ()
val map_snoc : f:('a->Tot 'b) -> x:'a -> l:list 'a -> Lemma
(ensures (map f (snoc l x) == snoc (map f l) (f x)))
let rec map_snoc f x l =
match l with
| [] -> ()
| h::t -> map_snoc f x t
val map_rev : f:('a->Tot 'b) -> l:(list 'a) -> Lemma
(ensures (map f (rev l) == rev (map f l)))
let rec map_rev f l =
match l with
| [] -> ()
| h::t -> map_snoc f h (rev t); map_rev f t
(* Map for options *)
val option_map : ('a -> Tot 'b) -> option 'a -> Tot (option 'b)
let option_map f o =
match o with
| None -> None
| Some a -> Some (f a)
(* Fold *)
val fold : (f : 'a -> 'b -> Tot 'b) -> list 'a -> 'b -> Tot 'b
let rec fold f l b =
match l with
| [] -> b
| h::t -> f h (fold f t b)
val fold_example1 : unit -> Lemma
(ensures (let open FStar.Mul in
fold (fun x y -> x * y) [1;2;3;4] 1 = 24))
let fold_example1 () = ()
val fold_example2 : unit -> Lemma
(ensures (fold (fun x y -> x && y) [true;true;false;true] true = false))
let fold_example2 () = ()
val fold_example3 : unit -> Lemma
(ensures (fold app [[1];[];[2;3];[4]] [] = [1;2;3;4]))
let fold_example3 () = ()
(* Functions For Constructing Functions *)
val constfun : 'a -> 'b -> Tot 'a
let constfun x _ = x
val ftrue : 'b -> Tot bool
(* This should work, but it doesn't: causes failed postconditions later on
let ftrue = constfun true *)
let ftrue _ = true
(* CH: This causes syntax error at character 12, is override a
keyword?
NS: Yes, override is a keyword. Only because it is a keyword in F#,
and since we (plan to) codegen to F# and Caml, unless we mangle
names, we inherit their keywords.
val override : ('a -> Tot 'b) -> 'a -> 'b -> 'a -> Tot 'b
*)
val my_override : #a:eqtype -> #b:Type -> (a -> Tot b) -> a -> b -> a -> Tot b
let my_override #a #b f k x k' = if k = k' then x else f k'
val fmostlytrue : int -> Tot bool
let fmostlytrue x = my_override (my_override ftrue 1 false) 3 false x
(* CH: these fail, too higher order? *)
(* NS: Not any more ... need to make currying explicit *)
(* CH: That's counter intuitive. I fail to see the
difference between implicit and explicit currying.
Isn't one just syntax sugar for the other? *)
val override_example1 : unit -> Lemma
(ensures (fmostlytrue 0 = true))
let override_example1 () = ()
val override_example2 : unit -> Lemma
(ensures (fmostlytrue 1 = false))
let override_example2 () = ()
val override_example3 : unit -> Lemma
(ensures (fmostlytrue 2 = true))
let override_example3 () = ()
val override_example4 : unit -> Lemma
(ensures (fmostlytrue 3 = false))
let override_example4 () = ()
val override_eq : #a:Type -> #b:eqtype -> x:a -> k:b -> f:(b->Tot a) -> Lemma
(ensures ((my_override f k x) k == x))
let override_eq #a #b x k f = ()
val override_neq : #a:Type -> #b:eqtype
-> x1:a -> x2:a -> k1:b -> k2:b -> f:(b->Tot a) -> Pure unit
(requires (f k1 == x1 /\ ~(k2 == k1)))
(ensures (fun r -> (my_override f k2 x2) k1 == x1))
let override_neq #a #b x1 x2 k1 k2 f = ()
(* NS: Experimenting first with named functions *)
val plus_one: 'a -> nat -> Tot nat
let plus_one m n = n + 1
val fold_length_named : l:list 'a -> Tot nat
let fold_length_named l = fold plus_one l 0
val fold_length_named_correct : l:list 'a -> Lemma
(ensures (fold_length_named l = length l))
let rec fold_length_named_correct l =
match l with
| [] -> ()
| h::t -> fold_length_named_correct t
(* NS: But, with named functions, you have to explicitly closure-convert ...
and the closure arguments have to be explicitly curried ... yuck *)
val fcons : ('a -> Tot 'b) -> 'a -> list 'b -> Tot (list 'b)
let fcons f x l = f x :: l
val fold_map_named : ('a->Tot 'b) -> list 'a -> Tot (list 'b)
let fold_map_named f l= fold (fcons f) l []
(* But it works *)
val fold_map_named_correct : f:('a->Tot 'b) -> l:list 'a -> Lemma
(ensures (fold_map_named f l == map f l))
let rec fold_map_named_correct f l =
match l with
| [] -> ()
| h::t -> fold_map_named_correct f t
(* NS: So, let's do better with closures this time *)
(* NS: The lambda here is relatively easy, since it has no free variables *)
val fold_length : l:list 'a -> Tot nat
let fold_length l = fold (fun _ (n:nat) -> n + 1) l 0
val fold_length_correct : l:list 'a -> Lemma
(ensures (fold_length l = length l))
let rec fold_length_correct l =
match l with
| [] -> ()
| h::t -> fold_length_correct t
(* NS: This lambda is fancier, since it captures 'f' in its environment *)
val fold_map : ('a->Tot 'b) -> list 'a -> Tot (list 'b)
let fold_map f l= fold (fun x l -> f x :: l) l []
val fold_map_correct : f:('a->Tot 'b) -> l:list 'a -> Lemma
(ensures (fold_map f l == map f l))
let rec fold_map_correct f l =
match l with
| [] -> ()
| h::t -> fold_map_correct f t
open FStar.List.Tot
val fold_right_cons_is_id: l:list 'a -> l':list 'a ->
Lemma (fold_right Cons l l' == (l @ l'))
let rec fold_right_cons_is_id l l' = match l with
| [] -> ()
| _::t -> fold_right_cons_is_id t l'
(* Church numerals *)
(* Using type abbreviation here does not work, even with full annotations
Problem seems similar to https://github.com/FStarLang/FStar/issues/15
and https://github.com/FStarLang/FStar/issues/23
type church 'a = ('a -> 'a) -> 'a -> 'a
val zero : church 'a
let zero ('a:Type) (f:'a->'a) (x:'a) = x
sf-poly.fst(371,0-373,3) : Error
Expected a term of type "('a:Type -> (church 'a))";
got a function "(fun 'a:Type f:('a -> 'a) x:'a -> x)"
*)
val zero : ('a->'a) -> 'a -> 'a
let zero f x = x
val one : ('a->'a) -> 'a -> 'a
let one f x = f x
val two : ('a->'a) -> 'a -> 'a
let two f x = f (f x)
val succ : (('a->'a) -> 'a -> 'a) -> ('a->'a) -> 'a -> 'a
let succ n f x = f (n f x)
val plus : (('a->'a) -> 'a -> 'a) -> (('a->'a) -> 'a -> 'a) -> ('a->'a) -> 'a -> 'a
let plus n m f x = n f (m f x) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 |
n: (_: (_: 'a -> 'a) -> _: 'a -> 'a) ->
m: (_: (_: 'a -> 'a) -> _: 'a -> 'a) ->
f: (_: 'a -> 'a) ->
x: 'a
-> 'a | Prims.Tot | [
"total"
] | [] | [] | [] | false | false | false | true | false | let mult n m f x =
| n (m f) x | false |
SfPoly.fst | SfPoly.one | val one : ('a->'a) -> 'a -> 'a | val one : ('a->'a) -> 'a -> 'a | let one f x = f x | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 17,
"end_line": 410,
"start_col": 0,
"start_line": 410
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *)
val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c
let prod_curry f x y = f (x,y)
val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c
let prod_uncurry f xy = f (fst xy) (snd xy)
val test_prod_uncurry: f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_uncurry f) (x, y) == f x y))
let test_prod_uncurry f x y = ()
val test_prod_curry: f:(('a * 'b)->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_curry f) x y == f (x, y)))
let test_prod_curry f x y = ()
val uncurry_curry : f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures (prod_curry (prod_uncurry f) x y == f x y))
let uncurry_curry f x y = ()
val curry_uncurry : f:(('a*'b)->Tot 'c) -> xy:('a*'b) -> Lemma
(ensures (prod_uncurry (prod_curry f) xy == f xy))
let curry_uncurry f xy = ()
(* Filter *)
val filter : test:('a->Tot bool) -> l:(list 'a) -> Tot (list 'a)
let rec filter test l =
match l with
| [] -> []
| h :: t -> if test h then h :: (filter test t)
else filter test t
val evenb : nat -> Tot bool
let evenb i = i%2 = 0
(* NS: Note: induction over non-inductive types like int is also fine *)
val evenb' : nat -> Tot bool
let rec evenb' i =
match i with
| 0 -> true
| 1 -> false
| _ -> evenb' (i-2)
val oddb : nat -> Tot bool
let oddb n = not (evenb n)
val test_filter1 : unit -> Lemma
(ensures (filter evenb [1;2;3;4] = [2;4]))
let test_filter1 () = ()
val test_filter2 : unit -> Lemma
(ensures (filter evenb' [1;2;3;4] = [2;4]))
let test_filter2 () = ()
(* Map *)
val map : ('a->Tot 'b) -> (list 'a) -> Tot (list 'b)
let rec map f l =
match l with
| [] -> []
| h :: t -> (f h) :: (map f t)
val test_map1 : unit -> Lemma
(ensures (map (fun n -> n + 3) [2;0;2] = [5;3;5]))
let test_map1 () = ()
val test_map2 : unit -> Lemma
(ensures (map oddb [2;1;2;5] = [false;true;false;true]))
let test_map2 () = ()
val test_map3 : unit -> Lemma
(ensures (map (fun n -> [evenb n;oddb n]) [2;1;2;5]
= [[true;false];[false;true];[true;false];[false;true]]))
let test_map3 () = ()
val map_snoc : f:('a->Tot 'b) -> x:'a -> l:list 'a -> Lemma
(ensures (map f (snoc l x) == snoc (map f l) (f x)))
let rec map_snoc f x l =
match l with
| [] -> ()
| h::t -> map_snoc f x t
val map_rev : f:('a->Tot 'b) -> l:(list 'a) -> Lemma
(ensures (map f (rev l) == rev (map f l)))
let rec map_rev f l =
match l with
| [] -> ()
| h::t -> map_snoc f h (rev t); map_rev f t
(* Map for options *)
val option_map : ('a -> Tot 'b) -> option 'a -> Tot (option 'b)
let option_map f o =
match o with
| None -> None
| Some a -> Some (f a)
(* Fold *)
val fold : (f : 'a -> 'b -> Tot 'b) -> list 'a -> 'b -> Tot 'b
let rec fold f l b =
match l with
| [] -> b
| h::t -> f h (fold f t b)
val fold_example1 : unit -> Lemma
(ensures (let open FStar.Mul in
fold (fun x y -> x * y) [1;2;3;4] 1 = 24))
let fold_example1 () = ()
val fold_example2 : unit -> Lemma
(ensures (fold (fun x y -> x && y) [true;true;false;true] true = false))
let fold_example2 () = ()
val fold_example3 : unit -> Lemma
(ensures (fold app [[1];[];[2;3];[4]] [] = [1;2;3;4]))
let fold_example3 () = ()
(* Functions For Constructing Functions *)
val constfun : 'a -> 'b -> Tot 'a
let constfun x _ = x
val ftrue : 'b -> Tot bool
(* This should work, but it doesn't: causes failed postconditions later on
let ftrue = constfun true *)
let ftrue _ = true
(* CH: This causes syntax error at character 12, is override a
keyword?
NS: Yes, override is a keyword. Only because it is a keyword in F#,
and since we (plan to) codegen to F# and Caml, unless we mangle
names, we inherit their keywords.
val override : ('a -> Tot 'b) -> 'a -> 'b -> 'a -> Tot 'b
*)
val my_override : #a:eqtype -> #b:Type -> (a -> Tot b) -> a -> b -> a -> Tot b
let my_override #a #b f k x k' = if k = k' then x else f k'
val fmostlytrue : int -> Tot bool
let fmostlytrue x = my_override (my_override ftrue 1 false) 3 false x
(* CH: these fail, too higher order? *)
(* NS: Not any more ... need to make currying explicit *)
(* CH: That's counter intuitive. I fail to see the
difference between implicit and explicit currying.
Isn't one just syntax sugar for the other? *)
val override_example1 : unit -> Lemma
(ensures (fmostlytrue 0 = true))
let override_example1 () = ()
val override_example2 : unit -> Lemma
(ensures (fmostlytrue 1 = false))
let override_example2 () = ()
val override_example3 : unit -> Lemma
(ensures (fmostlytrue 2 = true))
let override_example3 () = ()
val override_example4 : unit -> Lemma
(ensures (fmostlytrue 3 = false))
let override_example4 () = ()
val override_eq : #a:Type -> #b:eqtype -> x:a -> k:b -> f:(b->Tot a) -> Lemma
(ensures ((my_override f k x) k == x))
let override_eq #a #b x k f = ()
val override_neq : #a:Type -> #b:eqtype
-> x1:a -> x2:a -> k1:b -> k2:b -> f:(b->Tot a) -> Pure unit
(requires (f k1 == x1 /\ ~(k2 == k1)))
(ensures (fun r -> (my_override f k2 x2) k1 == x1))
let override_neq #a #b x1 x2 k1 k2 f = ()
(* NS: Experimenting first with named functions *)
val plus_one: 'a -> nat -> Tot nat
let plus_one m n = n + 1
val fold_length_named : l:list 'a -> Tot nat
let fold_length_named l = fold plus_one l 0
val fold_length_named_correct : l:list 'a -> Lemma
(ensures (fold_length_named l = length l))
let rec fold_length_named_correct l =
match l with
| [] -> ()
| h::t -> fold_length_named_correct t
(* NS: But, with named functions, you have to explicitly closure-convert ...
and the closure arguments have to be explicitly curried ... yuck *)
val fcons : ('a -> Tot 'b) -> 'a -> list 'b -> Tot (list 'b)
let fcons f x l = f x :: l
val fold_map_named : ('a->Tot 'b) -> list 'a -> Tot (list 'b)
let fold_map_named f l= fold (fcons f) l []
(* But it works *)
val fold_map_named_correct : f:('a->Tot 'b) -> l:list 'a -> Lemma
(ensures (fold_map_named f l == map f l))
let rec fold_map_named_correct f l =
match l with
| [] -> ()
| h::t -> fold_map_named_correct f t
(* NS: So, let's do better with closures this time *)
(* NS: The lambda here is relatively easy, since it has no free variables *)
val fold_length : l:list 'a -> Tot nat
let fold_length l = fold (fun _ (n:nat) -> n + 1) l 0
val fold_length_correct : l:list 'a -> Lemma
(ensures (fold_length l = length l))
let rec fold_length_correct l =
match l with
| [] -> ()
| h::t -> fold_length_correct t
(* NS: This lambda is fancier, since it captures 'f' in its environment *)
val fold_map : ('a->Tot 'b) -> list 'a -> Tot (list 'b)
let fold_map f l= fold (fun x l -> f x :: l) l []
val fold_map_correct : f:('a->Tot 'b) -> l:list 'a -> Lemma
(ensures (fold_map f l == map f l))
let rec fold_map_correct f l =
match l with
| [] -> ()
| h::t -> fold_map_correct f t
open FStar.List.Tot
val fold_right_cons_is_id: l:list 'a -> l':list 'a ->
Lemma (fold_right Cons l l' == (l @ l'))
let rec fold_right_cons_is_id l l' = match l with
| [] -> ()
| _::t -> fold_right_cons_is_id t l'
(* Church numerals *)
(* Using type abbreviation here does not work, even with full annotations
Problem seems similar to https://github.com/FStarLang/FStar/issues/15
and https://github.com/FStarLang/FStar/issues/23
type church 'a = ('a -> 'a) -> 'a -> 'a
val zero : church 'a
let zero ('a:Type) (f:'a->'a) (x:'a) = x
sf-poly.fst(371,0-373,3) : Error
Expected a term of type "('a:Type -> (church 'a))";
got a function "(fun 'a:Type f:('a -> 'a) x:'a -> x)"
*)
val zero : ('a->'a) -> 'a -> 'a
let zero f x = x | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | f: (_: 'a -> 'a) -> x: 'a -> 'a | Prims.Tot | [
"total"
] | [] | [] | [] | false | false | false | true | false | let one f x =
| f x | false |
SfPoly.fst | SfPoly.succ | val succ : (('a->'a) -> 'a -> 'a) -> ('a->'a) -> 'a -> 'a | val succ : (('a->'a) -> 'a -> 'a) -> ('a->'a) -> 'a -> 'a | let succ n f x = f (n f x) | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 26,
"end_line": 416,
"start_col": 0,
"start_line": 416
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *)
val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c
let prod_curry f x y = f (x,y)
val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c
let prod_uncurry f xy = f (fst xy) (snd xy)
val test_prod_uncurry: f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_uncurry f) (x, y) == f x y))
let test_prod_uncurry f x y = ()
val test_prod_curry: f:(('a * 'b)->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_curry f) x y == f (x, y)))
let test_prod_curry f x y = ()
val uncurry_curry : f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures (prod_curry (prod_uncurry f) x y == f x y))
let uncurry_curry f x y = ()
val curry_uncurry : f:(('a*'b)->Tot 'c) -> xy:('a*'b) -> Lemma
(ensures (prod_uncurry (prod_curry f) xy == f xy))
let curry_uncurry f xy = ()
(* Filter *)
val filter : test:('a->Tot bool) -> l:(list 'a) -> Tot (list 'a)
let rec filter test l =
match l with
| [] -> []
| h :: t -> if test h then h :: (filter test t)
else filter test t
val evenb : nat -> Tot bool
let evenb i = i%2 = 0
(* NS: Note: induction over non-inductive types like int is also fine *)
val evenb' : nat -> Tot bool
let rec evenb' i =
match i with
| 0 -> true
| 1 -> false
| _ -> evenb' (i-2)
val oddb : nat -> Tot bool
let oddb n = not (evenb n)
val test_filter1 : unit -> Lemma
(ensures (filter evenb [1;2;3;4] = [2;4]))
let test_filter1 () = ()
val test_filter2 : unit -> Lemma
(ensures (filter evenb' [1;2;3;4] = [2;4]))
let test_filter2 () = ()
(* Map *)
val map : ('a->Tot 'b) -> (list 'a) -> Tot (list 'b)
let rec map f l =
match l with
| [] -> []
| h :: t -> (f h) :: (map f t)
val test_map1 : unit -> Lemma
(ensures (map (fun n -> n + 3) [2;0;2] = [5;3;5]))
let test_map1 () = ()
val test_map2 : unit -> Lemma
(ensures (map oddb [2;1;2;5] = [false;true;false;true]))
let test_map2 () = ()
val test_map3 : unit -> Lemma
(ensures (map (fun n -> [evenb n;oddb n]) [2;1;2;5]
= [[true;false];[false;true];[true;false];[false;true]]))
let test_map3 () = ()
val map_snoc : f:('a->Tot 'b) -> x:'a -> l:list 'a -> Lemma
(ensures (map f (snoc l x) == snoc (map f l) (f x)))
let rec map_snoc f x l =
match l with
| [] -> ()
| h::t -> map_snoc f x t
val map_rev : f:('a->Tot 'b) -> l:(list 'a) -> Lemma
(ensures (map f (rev l) == rev (map f l)))
let rec map_rev f l =
match l with
| [] -> ()
| h::t -> map_snoc f h (rev t); map_rev f t
(* Map for options *)
val option_map : ('a -> Tot 'b) -> option 'a -> Tot (option 'b)
let option_map f o =
match o with
| None -> None
| Some a -> Some (f a)
(* Fold *)
val fold : (f : 'a -> 'b -> Tot 'b) -> list 'a -> 'b -> Tot 'b
let rec fold f l b =
match l with
| [] -> b
| h::t -> f h (fold f t b)
val fold_example1 : unit -> Lemma
(ensures (let open FStar.Mul in
fold (fun x y -> x * y) [1;2;3;4] 1 = 24))
let fold_example1 () = ()
val fold_example2 : unit -> Lemma
(ensures (fold (fun x y -> x && y) [true;true;false;true] true = false))
let fold_example2 () = ()
val fold_example3 : unit -> Lemma
(ensures (fold app [[1];[];[2;3];[4]] [] = [1;2;3;4]))
let fold_example3 () = ()
(* Functions For Constructing Functions *)
val constfun : 'a -> 'b -> Tot 'a
let constfun x _ = x
val ftrue : 'b -> Tot bool
(* This should work, but it doesn't: causes failed postconditions later on
let ftrue = constfun true *)
let ftrue _ = true
(* CH: This causes syntax error at character 12, is override a
keyword?
NS: Yes, override is a keyword. Only because it is a keyword in F#,
and since we (plan to) codegen to F# and Caml, unless we mangle
names, we inherit their keywords.
val override : ('a -> Tot 'b) -> 'a -> 'b -> 'a -> Tot 'b
*)
val my_override : #a:eqtype -> #b:Type -> (a -> Tot b) -> a -> b -> a -> Tot b
let my_override #a #b f k x k' = if k = k' then x else f k'
val fmostlytrue : int -> Tot bool
let fmostlytrue x = my_override (my_override ftrue 1 false) 3 false x
(* CH: these fail, too higher order? *)
(* NS: Not any more ... need to make currying explicit *)
(* CH: That's counter intuitive. I fail to see the
difference between implicit and explicit currying.
Isn't one just syntax sugar for the other? *)
val override_example1 : unit -> Lemma
(ensures (fmostlytrue 0 = true))
let override_example1 () = ()
val override_example2 : unit -> Lemma
(ensures (fmostlytrue 1 = false))
let override_example2 () = ()
val override_example3 : unit -> Lemma
(ensures (fmostlytrue 2 = true))
let override_example3 () = ()
val override_example4 : unit -> Lemma
(ensures (fmostlytrue 3 = false))
let override_example4 () = ()
val override_eq : #a:Type -> #b:eqtype -> x:a -> k:b -> f:(b->Tot a) -> Lemma
(ensures ((my_override f k x) k == x))
let override_eq #a #b x k f = ()
val override_neq : #a:Type -> #b:eqtype
-> x1:a -> x2:a -> k1:b -> k2:b -> f:(b->Tot a) -> Pure unit
(requires (f k1 == x1 /\ ~(k2 == k1)))
(ensures (fun r -> (my_override f k2 x2) k1 == x1))
let override_neq #a #b x1 x2 k1 k2 f = ()
(* NS: Experimenting first with named functions *)
val plus_one: 'a -> nat -> Tot nat
let plus_one m n = n + 1
val fold_length_named : l:list 'a -> Tot nat
let fold_length_named l = fold plus_one l 0
val fold_length_named_correct : l:list 'a -> Lemma
(ensures (fold_length_named l = length l))
let rec fold_length_named_correct l =
match l with
| [] -> ()
| h::t -> fold_length_named_correct t
(* NS: But, with named functions, you have to explicitly closure-convert ...
and the closure arguments have to be explicitly curried ... yuck *)
val fcons : ('a -> Tot 'b) -> 'a -> list 'b -> Tot (list 'b)
let fcons f x l = f x :: l
val fold_map_named : ('a->Tot 'b) -> list 'a -> Tot (list 'b)
let fold_map_named f l= fold (fcons f) l []
(* But it works *)
val fold_map_named_correct : f:('a->Tot 'b) -> l:list 'a -> Lemma
(ensures (fold_map_named f l == map f l))
let rec fold_map_named_correct f l =
match l with
| [] -> ()
| h::t -> fold_map_named_correct f t
(* NS: So, let's do better with closures this time *)
(* NS: The lambda here is relatively easy, since it has no free variables *)
val fold_length : l:list 'a -> Tot nat
let fold_length l = fold (fun _ (n:nat) -> n + 1) l 0
val fold_length_correct : l:list 'a -> Lemma
(ensures (fold_length l = length l))
let rec fold_length_correct l =
match l with
| [] -> ()
| h::t -> fold_length_correct t
(* NS: This lambda is fancier, since it captures 'f' in its environment *)
val fold_map : ('a->Tot 'b) -> list 'a -> Tot (list 'b)
let fold_map f l= fold (fun x l -> f x :: l) l []
val fold_map_correct : f:('a->Tot 'b) -> l:list 'a -> Lemma
(ensures (fold_map f l == map f l))
let rec fold_map_correct f l =
match l with
| [] -> ()
| h::t -> fold_map_correct f t
open FStar.List.Tot
val fold_right_cons_is_id: l:list 'a -> l':list 'a ->
Lemma (fold_right Cons l l' == (l @ l'))
let rec fold_right_cons_is_id l l' = match l with
| [] -> ()
| _::t -> fold_right_cons_is_id t l'
(* Church numerals *)
(* Using type abbreviation here does not work, even with full annotations
Problem seems similar to https://github.com/FStarLang/FStar/issues/15
and https://github.com/FStarLang/FStar/issues/23
type church 'a = ('a -> 'a) -> 'a -> 'a
val zero : church 'a
let zero ('a:Type) (f:'a->'a) (x:'a) = x
sf-poly.fst(371,0-373,3) : Error
Expected a term of type "('a:Type -> (church 'a))";
got a function "(fun 'a:Type f:('a -> 'a) x:'a -> x)"
*)
val zero : ('a->'a) -> 'a -> 'a
let zero f x = x
val one : ('a->'a) -> 'a -> 'a
let one f x = f x
val two : ('a->'a) -> 'a -> 'a
let two f x = f (f x) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | n: (_: (_: 'a -> 'a) -> _: 'a -> 'a) -> f: (_: 'a -> 'a) -> x: 'a -> 'a | Prims.Tot | [
"total"
] | [] | [] | [] | false | false | false | true | false | let succ n f x =
| f (n f x) | false |
SfPoly.fst | SfPoly.fold_length | val fold_length : l:list 'a -> Tot nat | val fold_length : l:list 'a -> Tot nat | let fold_length l = fold (fun _ (n:nat) -> n + 1) l 0 | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 53,
"end_line": 363,
"start_col": 0,
"start_line": 363
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *)
val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c
let prod_curry f x y = f (x,y)
val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c
let prod_uncurry f xy = f (fst xy) (snd xy)
val test_prod_uncurry: f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_uncurry f) (x, y) == f x y))
let test_prod_uncurry f x y = ()
val test_prod_curry: f:(('a * 'b)->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_curry f) x y == f (x, y)))
let test_prod_curry f x y = ()
val uncurry_curry : f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures (prod_curry (prod_uncurry f) x y == f x y))
let uncurry_curry f x y = ()
val curry_uncurry : f:(('a*'b)->Tot 'c) -> xy:('a*'b) -> Lemma
(ensures (prod_uncurry (prod_curry f) xy == f xy))
let curry_uncurry f xy = ()
(* Filter *)
val filter : test:('a->Tot bool) -> l:(list 'a) -> Tot (list 'a)
let rec filter test l =
match l with
| [] -> []
| h :: t -> if test h then h :: (filter test t)
else filter test t
val evenb : nat -> Tot bool
let evenb i = i%2 = 0
(* NS: Note: induction over non-inductive types like int is also fine *)
val evenb' : nat -> Tot bool
let rec evenb' i =
match i with
| 0 -> true
| 1 -> false
| _ -> evenb' (i-2)
val oddb : nat -> Tot bool
let oddb n = not (evenb n)
val test_filter1 : unit -> Lemma
(ensures (filter evenb [1;2;3;4] = [2;4]))
let test_filter1 () = ()
val test_filter2 : unit -> Lemma
(ensures (filter evenb' [1;2;3;4] = [2;4]))
let test_filter2 () = ()
(* Map *)
val map : ('a->Tot 'b) -> (list 'a) -> Tot (list 'b)
let rec map f l =
match l with
| [] -> []
| h :: t -> (f h) :: (map f t)
val test_map1 : unit -> Lemma
(ensures (map (fun n -> n + 3) [2;0;2] = [5;3;5]))
let test_map1 () = ()
val test_map2 : unit -> Lemma
(ensures (map oddb [2;1;2;5] = [false;true;false;true]))
let test_map2 () = ()
val test_map3 : unit -> Lemma
(ensures (map (fun n -> [evenb n;oddb n]) [2;1;2;5]
= [[true;false];[false;true];[true;false];[false;true]]))
let test_map3 () = ()
val map_snoc : f:('a->Tot 'b) -> x:'a -> l:list 'a -> Lemma
(ensures (map f (snoc l x) == snoc (map f l) (f x)))
let rec map_snoc f x l =
match l with
| [] -> ()
| h::t -> map_snoc f x t
val map_rev : f:('a->Tot 'b) -> l:(list 'a) -> Lemma
(ensures (map f (rev l) == rev (map f l)))
let rec map_rev f l =
match l with
| [] -> ()
| h::t -> map_snoc f h (rev t); map_rev f t
(* Map for options *)
val option_map : ('a -> Tot 'b) -> option 'a -> Tot (option 'b)
let option_map f o =
match o with
| None -> None
| Some a -> Some (f a)
(* Fold *)
val fold : (f : 'a -> 'b -> Tot 'b) -> list 'a -> 'b -> Tot 'b
let rec fold f l b =
match l with
| [] -> b
| h::t -> f h (fold f t b)
val fold_example1 : unit -> Lemma
(ensures (let open FStar.Mul in
fold (fun x y -> x * y) [1;2;3;4] 1 = 24))
let fold_example1 () = ()
val fold_example2 : unit -> Lemma
(ensures (fold (fun x y -> x && y) [true;true;false;true] true = false))
let fold_example2 () = ()
val fold_example3 : unit -> Lemma
(ensures (fold app [[1];[];[2;3];[4]] [] = [1;2;3;4]))
let fold_example3 () = ()
(* Functions For Constructing Functions *)
val constfun : 'a -> 'b -> Tot 'a
let constfun x _ = x
val ftrue : 'b -> Tot bool
(* This should work, but it doesn't: causes failed postconditions later on
let ftrue = constfun true *)
let ftrue _ = true
(* CH: This causes syntax error at character 12, is override a
keyword?
NS: Yes, override is a keyword. Only because it is a keyword in F#,
and since we (plan to) codegen to F# and Caml, unless we mangle
names, we inherit their keywords.
val override : ('a -> Tot 'b) -> 'a -> 'b -> 'a -> Tot 'b
*)
val my_override : #a:eqtype -> #b:Type -> (a -> Tot b) -> a -> b -> a -> Tot b
let my_override #a #b f k x k' = if k = k' then x else f k'
val fmostlytrue : int -> Tot bool
let fmostlytrue x = my_override (my_override ftrue 1 false) 3 false x
(* CH: these fail, too higher order? *)
(* NS: Not any more ... need to make currying explicit *)
(* CH: That's counter intuitive. I fail to see the
difference between implicit and explicit currying.
Isn't one just syntax sugar for the other? *)
val override_example1 : unit -> Lemma
(ensures (fmostlytrue 0 = true))
let override_example1 () = ()
val override_example2 : unit -> Lemma
(ensures (fmostlytrue 1 = false))
let override_example2 () = ()
val override_example3 : unit -> Lemma
(ensures (fmostlytrue 2 = true))
let override_example3 () = ()
val override_example4 : unit -> Lemma
(ensures (fmostlytrue 3 = false))
let override_example4 () = ()
val override_eq : #a:Type -> #b:eqtype -> x:a -> k:b -> f:(b->Tot a) -> Lemma
(ensures ((my_override f k x) k == x))
let override_eq #a #b x k f = ()
val override_neq : #a:Type -> #b:eqtype
-> x1:a -> x2:a -> k1:b -> k2:b -> f:(b->Tot a) -> Pure unit
(requires (f k1 == x1 /\ ~(k2 == k1)))
(ensures (fun r -> (my_override f k2 x2) k1 == x1))
let override_neq #a #b x1 x2 k1 k2 f = ()
(* NS: Experimenting first with named functions *)
val plus_one: 'a -> nat -> Tot nat
let plus_one m n = n + 1
val fold_length_named : l:list 'a -> Tot nat
let fold_length_named l = fold plus_one l 0
val fold_length_named_correct : l:list 'a -> Lemma
(ensures (fold_length_named l = length l))
let rec fold_length_named_correct l =
match l with
| [] -> ()
| h::t -> fold_length_named_correct t
(* NS: But, with named functions, you have to explicitly closure-convert ...
and the closure arguments have to be explicitly curried ... yuck *)
val fcons : ('a -> Tot 'b) -> 'a -> list 'b -> Tot (list 'b)
let fcons f x l = f x :: l
val fold_map_named : ('a->Tot 'b) -> list 'a -> Tot (list 'b)
let fold_map_named f l= fold (fcons f) l []
(* But it works *)
val fold_map_named_correct : f:('a->Tot 'b) -> l:list 'a -> Lemma
(ensures (fold_map_named f l == map f l))
let rec fold_map_named_correct f l =
match l with
| [] -> ()
| h::t -> fold_map_named_correct f t
(* NS: So, let's do better with closures this time *)
(* NS: The lambda here is relatively easy, since it has no free variables *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | l: Prims.list 'a -> Prims.nat | Prims.Tot | [
"total"
] | [] | [
"Prims.list",
"SfPoly.fold",
"Prims.nat",
"Prims.op_Addition"
] | [] | false | false | false | true | false | let fold_length l =
| fold (fun _ (n: nat) -> n + 1) l 0 | false |
SfPoly.fst | SfPoly.plus_one | val plus_one: 'a -> nat -> Tot nat | val plus_one: 'a -> nat -> Tot nat | let plus_one m n = n + 1 | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 24,
"end_line": 332,
"start_col": 0,
"start_line": 332
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *)
val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c
let prod_curry f x y = f (x,y)
val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c
let prod_uncurry f xy = f (fst xy) (snd xy)
val test_prod_uncurry: f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_uncurry f) (x, y) == f x y))
let test_prod_uncurry f x y = ()
val test_prod_curry: f:(('a * 'b)->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_curry f) x y == f (x, y)))
let test_prod_curry f x y = ()
val uncurry_curry : f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures (prod_curry (prod_uncurry f) x y == f x y))
let uncurry_curry f x y = ()
val curry_uncurry : f:(('a*'b)->Tot 'c) -> xy:('a*'b) -> Lemma
(ensures (prod_uncurry (prod_curry f) xy == f xy))
let curry_uncurry f xy = ()
(* Filter *)
val filter : test:('a->Tot bool) -> l:(list 'a) -> Tot (list 'a)
let rec filter test l =
match l with
| [] -> []
| h :: t -> if test h then h :: (filter test t)
else filter test t
val evenb : nat -> Tot bool
let evenb i = i%2 = 0
(* NS: Note: induction over non-inductive types like int is also fine *)
val evenb' : nat -> Tot bool
let rec evenb' i =
match i with
| 0 -> true
| 1 -> false
| _ -> evenb' (i-2)
val oddb : nat -> Tot bool
let oddb n = not (evenb n)
val test_filter1 : unit -> Lemma
(ensures (filter evenb [1;2;3;4] = [2;4]))
let test_filter1 () = ()
val test_filter2 : unit -> Lemma
(ensures (filter evenb' [1;2;3;4] = [2;4]))
let test_filter2 () = ()
(* Map *)
val map : ('a->Tot 'b) -> (list 'a) -> Tot (list 'b)
let rec map f l =
match l with
| [] -> []
| h :: t -> (f h) :: (map f t)
val test_map1 : unit -> Lemma
(ensures (map (fun n -> n + 3) [2;0;2] = [5;3;5]))
let test_map1 () = ()
val test_map2 : unit -> Lemma
(ensures (map oddb [2;1;2;5] = [false;true;false;true]))
let test_map2 () = ()
val test_map3 : unit -> Lemma
(ensures (map (fun n -> [evenb n;oddb n]) [2;1;2;5]
= [[true;false];[false;true];[true;false];[false;true]]))
let test_map3 () = ()
val map_snoc : f:('a->Tot 'b) -> x:'a -> l:list 'a -> Lemma
(ensures (map f (snoc l x) == snoc (map f l) (f x)))
let rec map_snoc f x l =
match l with
| [] -> ()
| h::t -> map_snoc f x t
val map_rev : f:('a->Tot 'b) -> l:(list 'a) -> Lemma
(ensures (map f (rev l) == rev (map f l)))
let rec map_rev f l =
match l with
| [] -> ()
| h::t -> map_snoc f h (rev t); map_rev f t
(* Map for options *)
val option_map : ('a -> Tot 'b) -> option 'a -> Tot (option 'b)
let option_map f o =
match o with
| None -> None
| Some a -> Some (f a)
(* Fold *)
val fold : (f : 'a -> 'b -> Tot 'b) -> list 'a -> 'b -> Tot 'b
let rec fold f l b =
match l with
| [] -> b
| h::t -> f h (fold f t b)
val fold_example1 : unit -> Lemma
(ensures (let open FStar.Mul in
fold (fun x y -> x * y) [1;2;3;4] 1 = 24))
let fold_example1 () = ()
val fold_example2 : unit -> Lemma
(ensures (fold (fun x y -> x && y) [true;true;false;true] true = false))
let fold_example2 () = ()
val fold_example3 : unit -> Lemma
(ensures (fold app [[1];[];[2;3];[4]] [] = [1;2;3;4]))
let fold_example3 () = ()
(* Functions For Constructing Functions *)
val constfun : 'a -> 'b -> Tot 'a
let constfun x _ = x
val ftrue : 'b -> Tot bool
(* This should work, but it doesn't: causes failed postconditions later on
let ftrue = constfun true *)
let ftrue _ = true
(* CH: This causes syntax error at character 12, is override a
keyword?
NS: Yes, override is a keyword. Only because it is a keyword in F#,
and since we (plan to) codegen to F# and Caml, unless we mangle
names, we inherit their keywords.
val override : ('a -> Tot 'b) -> 'a -> 'b -> 'a -> Tot 'b
*)
val my_override : #a:eqtype -> #b:Type -> (a -> Tot b) -> a -> b -> a -> Tot b
let my_override #a #b f k x k' = if k = k' then x else f k'
val fmostlytrue : int -> Tot bool
let fmostlytrue x = my_override (my_override ftrue 1 false) 3 false x
(* CH: these fail, too higher order? *)
(* NS: Not any more ... need to make currying explicit *)
(* CH: That's counter intuitive. I fail to see the
difference between implicit and explicit currying.
Isn't one just syntax sugar for the other? *)
val override_example1 : unit -> Lemma
(ensures (fmostlytrue 0 = true))
let override_example1 () = ()
val override_example2 : unit -> Lemma
(ensures (fmostlytrue 1 = false))
let override_example2 () = ()
val override_example3 : unit -> Lemma
(ensures (fmostlytrue 2 = true))
let override_example3 () = ()
val override_example4 : unit -> Lemma
(ensures (fmostlytrue 3 = false))
let override_example4 () = ()
val override_eq : #a:Type -> #b:eqtype -> x:a -> k:b -> f:(b->Tot a) -> Lemma
(ensures ((my_override f k x) k == x))
let override_eq #a #b x k f = ()
val override_neq : #a:Type -> #b:eqtype
-> x1:a -> x2:a -> k1:b -> k2:b -> f:(b->Tot a) -> Pure unit
(requires (f k1 == x1 /\ ~(k2 == k1)))
(ensures (fun r -> (my_override f k2 x2) k1 == x1))
let override_neq #a #b x1 x2 k1 k2 f = ()
(* NS: Experimenting first with named functions *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | m: 'a -> n: Prims.nat -> Prims.nat | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Prims.op_Addition"
] | [] | false | false | false | true | false | let plus_one m n =
| n + 1 | false |
SfPoly.fst | SfPoly.fold_length_named_correct | val fold_length_named_correct : l:list 'a -> Lemma
(ensures (fold_length_named l = length l)) | val fold_length_named_correct : l:list 'a -> Lemma
(ensures (fold_length_named l = length l)) | let rec fold_length_named_correct l =
match l with
| [] -> ()
| h::t -> fold_length_named_correct t | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 39,
"end_line": 342,
"start_col": 0,
"start_line": 339
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *)
val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c
let prod_curry f x y = f (x,y)
val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c
let prod_uncurry f xy = f (fst xy) (snd xy)
val test_prod_uncurry: f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_uncurry f) (x, y) == f x y))
let test_prod_uncurry f x y = ()
val test_prod_curry: f:(('a * 'b)->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_curry f) x y == f (x, y)))
let test_prod_curry f x y = ()
val uncurry_curry : f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures (prod_curry (prod_uncurry f) x y == f x y))
let uncurry_curry f x y = ()
val curry_uncurry : f:(('a*'b)->Tot 'c) -> xy:('a*'b) -> Lemma
(ensures (prod_uncurry (prod_curry f) xy == f xy))
let curry_uncurry f xy = ()
(* Filter *)
val filter : test:('a->Tot bool) -> l:(list 'a) -> Tot (list 'a)
let rec filter test l =
match l with
| [] -> []
| h :: t -> if test h then h :: (filter test t)
else filter test t
val evenb : nat -> Tot bool
let evenb i = i%2 = 0
(* NS: Note: induction over non-inductive types like int is also fine *)
val evenb' : nat -> Tot bool
let rec evenb' i =
match i with
| 0 -> true
| 1 -> false
| _ -> evenb' (i-2)
val oddb : nat -> Tot bool
let oddb n = not (evenb n)
val test_filter1 : unit -> Lemma
(ensures (filter evenb [1;2;3;4] = [2;4]))
let test_filter1 () = ()
val test_filter2 : unit -> Lemma
(ensures (filter evenb' [1;2;3;4] = [2;4]))
let test_filter2 () = ()
(* Map *)
val map : ('a->Tot 'b) -> (list 'a) -> Tot (list 'b)
let rec map f l =
match l with
| [] -> []
| h :: t -> (f h) :: (map f t)
val test_map1 : unit -> Lemma
(ensures (map (fun n -> n + 3) [2;0;2] = [5;3;5]))
let test_map1 () = ()
val test_map2 : unit -> Lemma
(ensures (map oddb [2;1;2;5] = [false;true;false;true]))
let test_map2 () = ()
val test_map3 : unit -> Lemma
(ensures (map (fun n -> [evenb n;oddb n]) [2;1;2;5]
= [[true;false];[false;true];[true;false];[false;true]]))
let test_map3 () = ()
val map_snoc : f:('a->Tot 'b) -> x:'a -> l:list 'a -> Lemma
(ensures (map f (snoc l x) == snoc (map f l) (f x)))
let rec map_snoc f x l =
match l with
| [] -> ()
| h::t -> map_snoc f x t
val map_rev : f:('a->Tot 'b) -> l:(list 'a) -> Lemma
(ensures (map f (rev l) == rev (map f l)))
let rec map_rev f l =
match l with
| [] -> ()
| h::t -> map_snoc f h (rev t); map_rev f t
(* Map for options *)
val option_map : ('a -> Tot 'b) -> option 'a -> Tot (option 'b)
let option_map f o =
match o with
| None -> None
| Some a -> Some (f a)
(* Fold *)
val fold : (f : 'a -> 'b -> Tot 'b) -> list 'a -> 'b -> Tot 'b
let rec fold f l b =
match l with
| [] -> b
| h::t -> f h (fold f t b)
val fold_example1 : unit -> Lemma
(ensures (let open FStar.Mul in
fold (fun x y -> x * y) [1;2;3;4] 1 = 24))
let fold_example1 () = ()
val fold_example2 : unit -> Lemma
(ensures (fold (fun x y -> x && y) [true;true;false;true] true = false))
let fold_example2 () = ()
val fold_example3 : unit -> Lemma
(ensures (fold app [[1];[];[2;3];[4]] [] = [1;2;3;4]))
let fold_example3 () = ()
(* Functions For Constructing Functions *)
val constfun : 'a -> 'b -> Tot 'a
let constfun x _ = x
val ftrue : 'b -> Tot bool
(* This should work, but it doesn't: causes failed postconditions later on
let ftrue = constfun true *)
let ftrue _ = true
(* CH: This causes syntax error at character 12, is override a
keyword?
NS: Yes, override is a keyword. Only because it is a keyword in F#,
and since we (plan to) codegen to F# and Caml, unless we mangle
names, we inherit their keywords.
val override : ('a -> Tot 'b) -> 'a -> 'b -> 'a -> Tot 'b
*)
val my_override : #a:eqtype -> #b:Type -> (a -> Tot b) -> a -> b -> a -> Tot b
let my_override #a #b f k x k' = if k = k' then x else f k'
val fmostlytrue : int -> Tot bool
let fmostlytrue x = my_override (my_override ftrue 1 false) 3 false x
(* CH: these fail, too higher order? *)
(* NS: Not any more ... need to make currying explicit *)
(* CH: That's counter intuitive. I fail to see the
difference between implicit and explicit currying.
Isn't one just syntax sugar for the other? *)
val override_example1 : unit -> Lemma
(ensures (fmostlytrue 0 = true))
let override_example1 () = ()
val override_example2 : unit -> Lemma
(ensures (fmostlytrue 1 = false))
let override_example2 () = ()
val override_example3 : unit -> Lemma
(ensures (fmostlytrue 2 = true))
let override_example3 () = ()
val override_example4 : unit -> Lemma
(ensures (fmostlytrue 3 = false))
let override_example4 () = ()
val override_eq : #a:Type -> #b:eqtype -> x:a -> k:b -> f:(b->Tot a) -> Lemma
(ensures ((my_override f k x) k == x))
let override_eq #a #b x k f = ()
val override_neq : #a:Type -> #b:eqtype
-> x1:a -> x2:a -> k1:b -> k2:b -> f:(b->Tot a) -> Pure unit
(requires (f k1 == x1 /\ ~(k2 == k1)))
(ensures (fun r -> (my_override f k2 x2) k1 == x1))
let override_neq #a #b x1 x2 k1 k2 f = ()
(* NS: Experimenting first with named functions *)
val plus_one: 'a -> nat -> Tot nat
let plus_one m n = n + 1
val fold_length_named : l:list 'a -> Tot nat
let fold_length_named l = fold plus_one l 0
val fold_length_named_correct : l:list 'a -> Lemma | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | l: Prims.list 'a -> FStar.Pervasives.Lemma (ensures SfPoly.fold_length_named l = SfPoly.length l) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.list",
"SfPoly.fold_length_named_correct",
"Prims.unit"
] | [
"recursion"
] | false | false | true | false | false | let rec fold_length_named_correct l =
| match l with
| [] -> ()
| h :: t -> fold_length_named_correct t | false |
SfPoly.fst | SfPoly.fold_length_correct | val fold_length_correct : l:list 'a -> Lemma
(ensures (fold_length l = length l)) | val fold_length_correct : l:list 'a -> Lemma
(ensures (fold_length l = length l)) | let rec fold_length_correct l =
match l with
| [] -> ()
| h::t -> fold_length_correct t | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 33,
"end_line": 370,
"start_col": 0,
"start_line": 367
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *)
val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c
let prod_curry f x y = f (x,y)
val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c
let prod_uncurry f xy = f (fst xy) (snd xy)
val test_prod_uncurry: f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_uncurry f) (x, y) == f x y))
let test_prod_uncurry f x y = ()
val test_prod_curry: f:(('a * 'b)->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_curry f) x y == f (x, y)))
let test_prod_curry f x y = ()
val uncurry_curry : f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures (prod_curry (prod_uncurry f) x y == f x y))
let uncurry_curry f x y = ()
val curry_uncurry : f:(('a*'b)->Tot 'c) -> xy:('a*'b) -> Lemma
(ensures (prod_uncurry (prod_curry f) xy == f xy))
let curry_uncurry f xy = ()
(* Filter *)
val filter : test:('a->Tot bool) -> l:(list 'a) -> Tot (list 'a)
let rec filter test l =
match l with
| [] -> []
| h :: t -> if test h then h :: (filter test t)
else filter test t
val evenb : nat -> Tot bool
let evenb i = i%2 = 0
(* NS: Note: induction over non-inductive types like int is also fine *)
val evenb' : nat -> Tot bool
let rec evenb' i =
match i with
| 0 -> true
| 1 -> false
| _ -> evenb' (i-2)
val oddb : nat -> Tot bool
let oddb n = not (evenb n)
val test_filter1 : unit -> Lemma
(ensures (filter evenb [1;2;3;4] = [2;4]))
let test_filter1 () = ()
val test_filter2 : unit -> Lemma
(ensures (filter evenb' [1;2;3;4] = [2;4]))
let test_filter2 () = ()
(* Map *)
val map : ('a->Tot 'b) -> (list 'a) -> Tot (list 'b)
let rec map f l =
match l with
| [] -> []
| h :: t -> (f h) :: (map f t)
val test_map1 : unit -> Lemma
(ensures (map (fun n -> n + 3) [2;0;2] = [5;3;5]))
let test_map1 () = ()
val test_map2 : unit -> Lemma
(ensures (map oddb [2;1;2;5] = [false;true;false;true]))
let test_map2 () = ()
val test_map3 : unit -> Lemma
(ensures (map (fun n -> [evenb n;oddb n]) [2;1;2;5]
= [[true;false];[false;true];[true;false];[false;true]]))
let test_map3 () = ()
val map_snoc : f:('a->Tot 'b) -> x:'a -> l:list 'a -> Lemma
(ensures (map f (snoc l x) == snoc (map f l) (f x)))
let rec map_snoc f x l =
match l with
| [] -> ()
| h::t -> map_snoc f x t
val map_rev : f:('a->Tot 'b) -> l:(list 'a) -> Lemma
(ensures (map f (rev l) == rev (map f l)))
let rec map_rev f l =
match l with
| [] -> ()
| h::t -> map_snoc f h (rev t); map_rev f t
(* Map for options *)
val option_map : ('a -> Tot 'b) -> option 'a -> Tot (option 'b)
let option_map f o =
match o with
| None -> None
| Some a -> Some (f a)
(* Fold *)
val fold : (f : 'a -> 'b -> Tot 'b) -> list 'a -> 'b -> Tot 'b
let rec fold f l b =
match l with
| [] -> b
| h::t -> f h (fold f t b)
val fold_example1 : unit -> Lemma
(ensures (let open FStar.Mul in
fold (fun x y -> x * y) [1;2;3;4] 1 = 24))
let fold_example1 () = ()
val fold_example2 : unit -> Lemma
(ensures (fold (fun x y -> x && y) [true;true;false;true] true = false))
let fold_example2 () = ()
val fold_example3 : unit -> Lemma
(ensures (fold app [[1];[];[2;3];[4]] [] = [1;2;3;4]))
let fold_example3 () = ()
(* Functions For Constructing Functions *)
val constfun : 'a -> 'b -> Tot 'a
let constfun x _ = x
val ftrue : 'b -> Tot bool
(* This should work, but it doesn't: causes failed postconditions later on
let ftrue = constfun true *)
let ftrue _ = true
(* CH: This causes syntax error at character 12, is override a
keyword?
NS: Yes, override is a keyword. Only because it is a keyword in F#,
and since we (plan to) codegen to F# and Caml, unless we mangle
names, we inherit their keywords.
val override : ('a -> Tot 'b) -> 'a -> 'b -> 'a -> Tot 'b
*)
val my_override : #a:eqtype -> #b:Type -> (a -> Tot b) -> a -> b -> a -> Tot b
let my_override #a #b f k x k' = if k = k' then x else f k'
val fmostlytrue : int -> Tot bool
let fmostlytrue x = my_override (my_override ftrue 1 false) 3 false x
(* CH: these fail, too higher order? *)
(* NS: Not any more ... need to make currying explicit *)
(* CH: That's counter intuitive. I fail to see the
difference between implicit and explicit currying.
Isn't one just syntax sugar for the other? *)
val override_example1 : unit -> Lemma
(ensures (fmostlytrue 0 = true))
let override_example1 () = ()
val override_example2 : unit -> Lemma
(ensures (fmostlytrue 1 = false))
let override_example2 () = ()
val override_example3 : unit -> Lemma
(ensures (fmostlytrue 2 = true))
let override_example3 () = ()
val override_example4 : unit -> Lemma
(ensures (fmostlytrue 3 = false))
let override_example4 () = ()
val override_eq : #a:Type -> #b:eqtype -> x:a -> k:b -> f:(b->Tot a) -> Lemma
(ensures ((my_override f k x) k == x))
let override_eq #a #b x k f = ()
val override_neq : #a:Type -> #b:eqtype
-> x1:a -> x2:a -> k1:b -> k2:b -> f:(b->Tot a) -> Pure unit
(requires (f k1 == x1 /\ ~(k2 == k1)))
(ensures (fun r -> (my_override f k2 x2) k1 == x1))
let override_neq #a #b x1 x2 k1 k2 f = ()
(* NS: Experimenting first with named functions *)
val plus_one: 'a -> nat -> Tot nat
let plus_one m n = n + 1
val fold_length_named : l:list 'a -> Tot nat
let fold_length_named l = fold plus_one l 0
val fold_length_named_correct : l:list 'a -> Lemma
(ensures (fold_length_named l = length l))
let rec fold_length_named_correct l =
match l with
| [] -> ()
| h::t -> fold_length_named_correct t
(* NS: But, with named functions, you have to explicitly closure-convert ...
and the closure arguments have to be explicitly curried ... yuck *)
val fcons : ('a -> Tot 'b) -> 'a -> list 'b -> Tot (list 'b)
let fcons f x l = f x :: l
val fold_map_named : ('a->Tot 'b) -> list 'a -> Tot (list 'b)
let fold_map_named f l= fold (fcons f) l []
(* But it works *)
val fold_map_named_correct : f:('a->Tot 'b) -> l:list 'a -> Lemma
(ensures (fold_map_named f l == map f l))
let rec fold_map_named_correct f l =
match l with
| [] -> ()
| h::t -> fold_map_named_correct f t
(* NS: So, let's do better with closures this time *)
(* NS: The lambda here is relatively easy, since it has no free variables *)
val fold_length : l:list 'a -> Tot nat
let fold_length l = fold (fun _ (n:nat) -> n + 1) l 0
val fold_length_correct : l:list 'a -> Lemma | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | l: Prims.list 'a -> FStar.Pervasives.Lemma (ensures SfPoly.fold_length l = SfPoly.length l) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.list",
"SfPoly.fold_length_correct",
"Prims.unit"
] | [
"recursion"
] | false | false | true | false | false | let rec fold_length_correct l =
| match l with
| [] -> ()
| h :: t -> fold_length_correct t | false |
SfPoly.fst | SfPoly.fold_map_correct | val fold_map_correct : f:('a->Tot 'b) -> l:list 'a -> Lemma
(ensures (fold_map f l == map f l)) | val fold_map_correct : f:('a->Tot 'b) -> l:list 'a -> Lemma
(ensures (fold_map f l == map f l)) | let rec fold_map_correct f l =
match l with
| [] -> ()
| h::t -> fold_map_correct f t | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 32,
"end_line": 381,
"start_col": 0,
"start_line": 378
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *)
val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c
let prod_curry f x y = f (x,y)
val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c
let prod_uncurry f xy = f (fst xy) (snd xy)
val test_prod_uncurry: f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_uncurry f) (x, y) == f x y))
let test_prod_uncurry f x y = ()
val test_prod_curry: f:(('a * 'b)->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_curry f) x y == f (x, y)))
let test_prod_curry f x y = ()
val uncurry_curry : f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures (prod_curry (prod_uncurry f) x y == f x y))
let uncurry_curry f x y = ()
val curry_uncurry : f:(('a*'b)->Tot 'c) -> xy:('a*'b) -> Lemma
(ensures (prod_uncurry (prod_curry f) xy == f xy))
let curry_uncurry f xy = ()
(* Filter *)
val filter : test:('a->Tot bool) -> l:(list 'a) -> Tot (list 'a)
let rec filter test l =
match l with
| [] -> []
| h :: t -> if test h then h :: (filter test t)
else filter test t
val evenb : nat -> Tot bool
let evenb i = i%2 = 0
(* NS: Note: induction over non-inductive types like int is also fine *)
val evenb' : nat -> Tot bool
let rec evenb' i =
match i with
| 0 -> true
| 1 -> false
| _ -> evenb' (i-2)
val oddb : nat -> Tot bool
let oddb n = not (evenb n)
val test_filter1 : unit -> Lemma
(ensures (filter evenb [1;2;3;4] = [2;4]))
let test_filter1 () = ()
val test_filter2 : unit -> Lemma
(ensures (filter evenb' [1;2;3;4] = [2;4]))
let test_filter2 () = ()
(* Map *)
val map : ('a->Tot 'b) -> (list 'a) -> Tot (list 'b)
let rec map f l =
match l with
| [] -> []
| h :: t -> (f h) :: (map f t)
val test_map1 : unit -> Lemma
(ensures (map (fun n -> n + 3) [2;0;2] = [5;3;5]))
let test_map1 () = ()
val test_map2 : unit -> Lemma
(ensures (map oddb [2;1;2;5] = [false;true;false;true]))
let test_map2 () = ()
val test_map3 : unit -> Lemma
(ensures (map (fun n -> [evenb n;oddb n]) [2;1;2;5]
= [[true;false];[false;true];[true;false];[false;true]]))
let test_map3 () = ()
val map_snoc : f:('a->Tot 'b) -> x:'a -> l:list 'a -> Lemma
(ensures (map f (snoc l x) == snoc (map f l) (f x)))
let rec map_snoc f x l =
match l with
| [] -> ()
| h::t -> map_snoc f x t
val map_rev : f:('a->Tot 'b) -> l:(list 'a) -> Lemma
(ensures (map f (rev l) == rev (map f l)))
let rec map_rev f l =
match l with
| [] -> ()
| h::t -> map_snoc f h (rev t); map_rev f t
(* Map for options *)
val option_map : ('a -> Tot 'b) -> option 'a -> Tot (option 'b)
let option_map f o =
match o with
| None -> None
| Some a -> Some (f a)
(* Fold *)
val fold : (f : 'a -> 'b -> Tot 'b) -> list 'a -> 'b -> Tot 'b
let rec fold f l b =
match l with
| [] -> b
| h::t -> f h (fold f t b)
val fold_example1 : unit -> Lemma
(ensures (let open FStar.Mul in
fold (fun x y -> x * y) [1;2;3;4] 1 = 24))
let fold_example1 () = ()
val fold_example2 : unit -> Lemma
(ensures (fold (fun x y -> x && y) [true;true;false;true] true = false))
let fold_example2 () = ()
val fold_example3 : unit -> Lemma
(ensures (fold app [[1];[];[2;3];[4]] [] = [1;2;3;4]))
let fold_example3 () = ()
(* Functions For Constructing Functions *)
val constfun : 'a -> 'b -> Tot 'a
let constfun x _ = x
val ftrue : 'b -> Tot bool
(* This should work, but it doesn't: causes failed postconditions later on
let ftrue = constfun true *)
let ftrue _ = true
(* CH: This causes syntax error at character 12, is override a
keyword?
NS: Yes, override is a keyword. Only because it is a keyword in F#,
and since we (plan to) codegen to F# and Caml, unless we mangle
names, we inherit their keywords.
val override : ('a -> Tot 'b) -> 'a -> 'b -> 'a -> Tot 'b
*)
val my_override : #a:eqtype -> #b:Type -> (a -> Tot b) -> a -> b -> a -> Tot b
let my_override #a #b f k x k' = if k = k' then x else f k'
val fmostlytrue : int -> Tot bool
let fmostlytrue x = my_override (my_override ftrue 1 false) 3 false x
(* CH: these fail, too higher order? *)
(* NS: Not any more ... need to make currying explicit *)
(* CH: That's counter intuitive. I fail to see the
difference between implicit and explicit currying.
Isn't one just syntax sugar for the other? *)
val override_example1 : unit -> Lemma
(ensures (fmostlytrue 0 = true))
let override_example1 () = ()
val override_example2 : unit -> Lemma
(ensures (fmostlytrue 1 = false))
let override_example2 () = ()
val override_example3 : unit -> Lemma
(ensures (fmostlytrue 2 = true))
let override_example3 () = ()
val override_example4 : unit -> Lemma
(ensures (fmostlytrue 3 = false))
let override_example4 () = ()
val override_eq : #a:Type -> #b:eqtype -> x:a -> k:b -> f:(b->Tot a) -> Lemma
(ensures ((my_override f k x) k == x))
let override_eq #a #b x k f = ()
val override_neq : #a:Type -> #b:eqtype
-> x1:a -> x2:a -> k1:b -> k2:b -> f:(b->Tot a) -> Pure unit
(requires (f k1 == x1 /\ ~(k2 == k1)))
(ensures (fun r -> (my_override f k2 x2) k1 == x1))
let override_neq #a #b x1 x2 k1 k2 f = ()
(* NS: Experimenting first with named functions *)
val plus_one: 'a -> nat -> Tot nat
let plus_one m n = n + 1
val fold_length_named : l:list 'a -> Tot nat
let fold_length_named l = fold plus_one l 0
val fold_length_named_correct : l:list 'a -> Lemma
(ensures (fold_length_named l = length l))
let rec fold_length_named_correct l =
match l with
| [] -> ()
| h::t -> fold_length_named_correct t
(* NS: But, with named functions, you have to explicitly closure-convert ...
and the closure arguments have to be explicitly curried ... yuck *)
val fcons : ('a -> Tot 'b) -> 'a -> list 'b -> Tot (list 'b)
let fcons f x l = f x :: l
val fold_map_named : ('a->Tot 'b) -> list 'a -> Tot (list 'b)
let fold_map_named f l= fold (fcons f) l []
(* But it works *)
val fold_map_named_correct : f:('a->Tot 'b) -> l:list 'a -> Lemma
(ensures (fold_map_named f l == map f l))
let rec fold_map_named_correct f l =
match l with
| [] -> ()
| h::t -> fold_map_named_correct f t
(* NS: So, let's do better with closures this time *)
(* NS: The lambda here is relatively easy, since it has no free variables *)
val fold_length : l:list 'a -> Tot nat
let fold_length l = fold (fun _ (n:nat) -> n + 1) l 0
val fold_length_correct : l:list 'a -> Lemma
(ensures (fold_length l = length l))
let rec fold_length_correct l =
match l with
| [] -> ()
| h::t -> fold_length_correct t
(* NS: This lambda is fancier, since it captures 'f' in its environment *)
val fold_map : ('a->Tot 'b) -> list 'a -> Tot (list 'b)
let fold_map f l= fold (fun x l -> f x :: l) l []
val fold_map_correct : f:('a->Tot 'b) -> l:list 'a -> Lemma | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 | f: (_: 'a -> 'b) -> l: Prims.list 'a
-> FStar.Pervasives.Lemma (ensures SfPoly.fold_map f l == SfPoly.map f l) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.list",
"SfPoly.fold_map_correct",
"Prims.unit"
] | [
"recursion"
] | false | false | true | false | false | let rec fold_map_correct f l =
| match l with
| [] -> ()
| h :: t -> fold_map_correct f t | false |
SfPoly.fst | SfPoly.fold_right_cons_is_id | val fold_right_cons_is_id: l:list 'a -> l':list 'a ->
Lemma (fold_right Cons l l' == (l @ l')) | val fold_right_cons_is_id: l:list 'a -> l':list 'a ->
Lemma (fold_right Cons l l' == (l @ l')) | let rec fold_right_cons_is_id l l' = match l with
| [] -> ()
| _::t -> fold_right_cons_is_id t l' | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 38,
"end_line": 388,
"start_col": 0,
"start_line": 386
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *)
val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c
let prod_curry f x y = f (x,y)
val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c
let prod_uncurry f xy = f (fst xy) (snd xy)
val test_prod_uncurry: f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_uncurry f) (x, y) == f x y))
let test_prod_uncurry f x y = ()
val test_prod_curry: f:(('a * 'b)->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_curry f) x y == f (x, y)))
let test_prod_curry f x y = ()
val uncurry_curry : f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures (prod_curry (prod_uncurry f) x y == f x y))
let uncurry_curry f x y = ()
val curry_uncurry : f:(('a*'b)->Tot 'c) -> xy:('a*'b) -> Lemma
(ensures (prod_uncurry (prod_curry f) xy == f xy))
let curry_uncurry f xy = ()
(* Filter *)
val filter : test:('a->Tot bool) -> l:(list 'a) -> Tot (list 'a)
let rec filter test l =
match l with
| [] -> []
| h :: t -> if test h then h :: (filter test t)
else filter test t
val evenb : nat -> Tot bool
let evenb i = i%2 = 0
(* NS: Note: induction over non-inductive types like int is also fine *)
val evenb' : nat -> Tot bool
let rec evenb' i =
match i with
| 0 -> true
| 1 -> false
| _ -> evenb' (i-2)
val oddb : nat -> Tot bool
let oddb n = not (evenb n)
val test_filter1 : unit -> Lemma
(ensures (filter evenb [1;2;3;4] = [2;4]))
let test_filter1 () = ()
val test_filter2 : unit -> Lemma
(ensures (filter evenb' [1;2;3;4] = [2;4]))
let test_filter2 () = ()
(* Map *)
val map : ('a->Tot 'b) -> (list 'a) -> Tot (list 'b)
let rec map f l =
match l with
| [] -> []
| h :: t -> (f h) :: (map f t)
val test_map1 : unit -> Lemma
(ensures (map (fun n -> n + 3) [2;0;2] = [5;3;5]))
let test_map1 () = ()
val test_map2 : unit -> Lemma
(ensures (map oddb [2;1;2;5] = [false;true;false;true]))
let test_map2 () = ()
val test_map3 : unit -> Lemma
(ensures (map (fun n -> [evenb n;oddb n]) [2;1;2;5]
= [[true;false];[false;true];[true;false];[false;true]]))
let test_map3 () = ()
val map_snoc : f:('a->Tot 'b) -> x:'a -> l:list 'a -> Lemma
(ensures (map f (snoc l x) == snoc (map f l) (f x)))
let rec map_snoc f x l =
match l with
| [] -> ()
| h::t -> map_snoc f x t
val map_rev : f:('a->Tot 'b) -> l:(list 'a) -> Lemma
(ensures (map f (rev l) == rev (map f l)))
let rec map_rev f l =
match l with
| [] -> ()
| h::t -> map_snoc f h (rev t); map_rev f t
(* Map for options *)
val option_map : ('a -> Tot 'b) -> option 'a -> Tot (option 'b)
let option_map f o =
match o with
| None -> None
| Some a -> Some (f a)
(* Fold *)
val fold : (f : 'a -> 'b -> Tot 'b) -> list 'a -> 'b -> Tot 'b
let rec fold f l b =
match l with
| [] -> b
| h::t -> f h (fold f t b)
val fold_example1 : unit -> Lemma
(ensures (let open FStar.Mul in
fold (fun x y -> x * y) [1;2;3;4] 1 = 24))
let fold_example1 () = ()
val fold_example2 : unit -> Lemma
(ensures (fold (fun x y -> x && y) [true;true;false;true] true = false))
let fold_example2 () = ()
val fold_example3 : unit -> Lemma
(ensures (fold app [[1];[];[2;3];[4]] [] = [1;2;3;4]))
let fold_example3 () = ()
(* Functions For Constructing Functions *)
val constfun : 'a -> 'b -> Tot 'a
let constfun x _ = x
val ftrue : 'b -> Tot bool
(* This should work, but it doesn't: causes failed postconditions later on
let ftrue = constfun true *)
let ftrue _ = true
(* CH: This causes syntax error at character 12, is override a
keyword?
NS: Yes, override is a keyword. Only because it is a keyword in F#,
and since we (plan to) codegen to F# and Caml, unless we mangle
names, we inherit their keywords.
val override : ('a -> Tot 'b) -> 'a -> 'b -> 'a -> Tot 'b
*)
val my_override : #a:eqtype -> #b:Type -> (a -> Tot b) -> a -> b -> a -> Tot b
let my_override #a #b f k x k' = if k = k' then x else f k'
val fmostlytrue : int -> Tot bool
let fmostlytrue x = my_override (my_override ftrue 1 false) 3 false x
(* CH: these fail, too higher order? *)
(* NS: Not any more ... need to make currying explicit *)
(* CH: That's counter intuitive. I fail to see the
difference between implicit and explicit currying.
Isn't one just syntax sugar for the other? *)
val override_example1 : unit -> Lemma
(ensures (fmostlytrue 0 = true))
let override_example1 () = ()
val override_example2 : unit -> Lemma
(ensures (fmostlytrue 1 = false))
let override_example2 () = ()
val override_example3 : unit -> Lemma
(ensures (fmostlytrue 2 = true))
let override_example3 () = ()
val override_example4 : unit -> Lemma
(ensures (fmostlytrue 3 = false))
let override_example4 () = ()
val override_eq : #a:Type -> #b:eqtype -> x:a -> k:b -> f:(b->Tot a) -> Lemma
(ensures ((my_override f k x) k == x))
let override_eq #a #b x k f = ()
val override_neq : #a:Type -> #b:eqtype
-> x1:a -> x2:a -> k1:b -> k2:b -> f:(b->Tot a) -> Pure unit
(requires (f k1 == x1 /\ ~(k2 == k1)))
(ensures (fun r -> (my_override f k2 x2) k1 == x1))
let override_neq #a #b x1 x2 k1 k2 f = ()
(* NS: Experimenting first with named functions *)
val plus_one: 'a -> nat -> Tot nat
let plus_one m n = n + 1
val fold_length_named : l:list 'a -> Tot nat
let fold_length_named l = fold plus_one l 0
val fold_length_named_correct : l:list 'a -> Lemma
(ensures (fold_length_named l = length l))
let rec fold_length_named_correct l =
match l with
| [] -> ()
| h::t -> fold_length_named_correct t
(* NS: But, with named functions, you have to explicitly closure-convert ...
and the closure arguments have to be explicitly curried ... yuck *)
val fcons : ('a -> Tot 'b) -> 'a -> list 'b -> Tot (list 'b)
let fcons f x l = f x :: l
val fold_map_named : ('a->Tot 'b) -> list 'a -> Tot (list 'b)
let fold_map_named f l= fold (fcons f) l []
(* But it works *)
val fold_map_named_correct : f:('a->Tot 'b) -> l:list 'a -> Lemma
(ensures (fold_map_named f l == map f l))
let rec fold_map_named_correct f l =
match l with
| [] -> ()
| h::t -> fold_map_named_correct f t
(* NS: So, let's do better with closures this time *)
(* NS: The lambda here is relatively easy, since it has no free variables *)
val fold_length : l:list 'a -> Tot nat
let fold_length l = fold (fun _ (n:nat) -> n + 1) l 0
val fold_length_correct : l:list 'a -> Lemma
(ensures (fold_length l = length l))
let rec fold_length_correct l =
match l with
| [] -> ()
| h::t -> fold_length_correct t
(* NS: This lambda is fancier, since it captures 'f' in its environment *)
val fold_map : ('a->Tot 'b) -> list 'a -> Tot (list 'b)
let fold_map f l= fold (fun x l -> f x :: l) l []
val fold_map_correct : f:('a->Tot 'b) -> l:list 'a -> Lemma
(ensures (fold_map f l == map f l))
let rec fold_map_correct f l =
match l with
| [] -> ()
| h::t -> fold_map_correct f t
open FStar.List.Tot
val fold_right_cons_is_id: l:list 'a -> l':list 'a -> | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | l: Prims.list 'a -> l': Prims.list 'a
-> FStar.Pervasives.Lemma (ensures FStar.List.Tot.Base.fold_right Prims.Cons l l' == l @ l') | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.list",
"SfPoly.fold_right_cons_is_id",
"Prims.unit"
] | [
"recursion"
] | false | false | true | false | false | let rec fold_right_cons_is_id l l' =
| match l with
| [] -> ()
| _ :: t -> fold_right_cons_is_id t l' | false |
SfPoly.fst | SfPoly.fold_map_named_correct | val fold_map_named_correct : f:('a->Tot 'b) -> l:list 'a -> Lemma
(ensures (fold_map_named f l == map f l)) | val fold_map_named_correct : f:('a->Tot 'b) -> l:list 'a -> Lemma
(ensures (fold_map_named f l == map f l)) | let rec fold_map_named_correct f l =
match l with
| [] -> ()
| h::t -> fold_map_named_correct f t | {
"file_name": "examples/software_foundations/SfPoly.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 38,
"end_line": 358,
"start_col": 0,
"start_line": 355
} | (*
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.
*)
(*
A translation to F* of Poly.v from Software Foundations
Original name: "Polymorphism and Higher-Order Functions"
*)
(* This chapter is very boring in terms of proofs *)
module SfPoly
(* Lists, pairs, options (using the F* definitions directly) *)
val length : list 'a -> Tot nat
let rec length l =
match l with
| [] -> 0
| hd::tl -> 1 + length tl
val test_length1 : unit -> Lemma
(ensures (length [1;2] = 2))
let test_length1 () = ()
val test_length2 : unit -> Lemma
(ensures (length [true] = 1))
let test_length2 () = ()
val length_nil : #a:Type -> unit -> Lemma
(ensures (length #a [] = 0))
let length_nil #a () = ()
val length_cons : h:'a -> t:list 'a -> Lemma
(ensures (length (h::t) = 1 + length t))
let length_cons h t = ()
val app : list 'a -> list 'a -> Tot (list 'a)
let rec app l1 l2 =
match l1 with
| [] -> l2
| h::t -> h :: app t l2
val nil_app : l : list 'a -> Lemma
(ensures (app [] l == l))
let nil_app l = ()
val app_nil : l : list 'a -> Lemma
(ensures (app l [] == l))
let rec app_nil l =
match l with
| [] -> ()
| h::t -> app_nil t
val length_app : l1:list 'a -> l2:list 'a -> Lemma
(ensures (length (app l1 l2) = length l1 + length l2))
let rec length_app l1 l2 =
match l1 with
| [] -> ()
| h::t -> length_app t l2
val snoc : list 'a -> 'a -> Tot (list 'a)
let rec snoc l x =
match l with
| [] -> [x]
| h::t -> h :: snoc t x
val snoc_with_append : l1:list 'a -> l2:list 'a -> a:'a -> Lemma
(ensures (snoc (app l1 l2) a == app l1 (snoc l2 a)))
let rec snoc_with_append l1 l2 a =
match l1 with
| [] -> ()
| a1 :: l1' -> snoc_with_append l1' l2 a
val rev : list 'a -> Tot (list 'a)
let rec rev l =
match l with
| [] -> []
| h::t -> snoc (rev t) h
val rev_snoc : a:'a -> l:list 'a -> Lemma
(ensures (rev (snoc l a) == a :: (rev l)))
let rec rev_snoc a l =
match l with
| [] -> ()
| h::t -> rev_snoc a t
val rev_involutive : l:list 'a -> Lemma
(ensures (rev (rev l)) == l)
let rec rev_involutive l =
match l with
| [] -> ()
| h::t -> rev_snoc h (rev t); rev_involutive t
val repeat : 'a -> nat -> list 'a
let rec repeat a n =
match n with
| 0 -> []
| _ -> a :: (repeat a (n-1))
val combine : list 'a -> list 'b -> list ('a * 'b)
let rec combine la lb =
match (la,lb) with
| ([],_) -> []
| (_,[]) -> []
| (a::ta, b::tb) -> (a,b) :: (combine ta tb)
(* In SF index returns an option, but we can do much better *)
val index_option : list 'a -> nat -> Tot (option 'a)
let rec index_option l n =
match l with
| [] -> None
| h :: t -> if n = 0 then Some h else index_option t (n-1)
val test_index_option1 : unit -> Lemma
(ensures (index_option [4;5;6;7] 0 = Some 4))
let test_index_option1 () = ()
val test_index_option2 : unit -> Lemma
(ensures (index_option [[1];[2]] 1 = Some [2]))
let test_index_option2 () = ()
val test_index_option3 : unit -> Lemma
(ensures (index_option [true] 2 = None))
let test_index_option3 () = ()
val index : l : list 'a -> n:int{(0 <= n) /\ (n < length l)} -> Tot 'a
let rec index l n =
match l with
| h :: t -> if n = 0 then h else index t (n-1)
(* Functions as Data *)
(* NS: Unannotated let recs have the ALL effect. To get the Tot effect, you must request it (enabling the termination checker).
NS: BTW, the default function type has ML effect, so if not annotated, test will be in ML, and so the whole thing will be ALL.
NS: An alternative may be to have some other syntax, like fix instead let rec, to locally change the default function effect to Tot. *)
(* Currying *)
(* NS: it used to be that if you intended to partially apply
a function, then you had to indicate it as such in the type.
Not so any more. *)
val prod_curry : (('a * 'b) -> Tot 'c) -> 'a -> 'b -> Tot 'c
let prod_curry f x y = f (x,y)
val prod_uncurry : ('a -> 'b -> Tot 'c) -> ('a * 'b) -> Tot 'c
let prod_uncurry f xy = f (fst xy) (snd xy)
val test_prod_uncurry: f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_uncurry f) (x, y) == f x y))
let test_prod_uncurry f x y = ()
val test_prod_curry: f:(('a * 'b)->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures ((prod_curry f) x y == f (x, y)))
let test_prod_curry f x y = ()
val uncurry_curry : f:('a->'b->Tot 'c) -> x:'a -> y:'b -> Lemma
(ensures (prod_curry (prod_uncurry f) x y == f x y))
let uncurry_curry f x y = ()
val curry_uncurry : f:(('a*'b)->Tot 'c) -> xy:('a*'b) -> Lemma
(ensures (prod_uncurry (prod_curry f) xy == f xy))
let curry_uncurry f xy = ()
(* Filter *)
val filter : test:('a->Tot bool) -> l:(list 'a) -> Tot (list 'a)
let rec filter test l =
match l with
| [] -> []
| h :: t -> if test h then h :: (filter test t)
else filter test t
val evenb : nat -> Tot bool
let evenb i = i%2 = 0
(* NS: Note: induction over non-inductive types like int is also fine *)
val evenb' : nat -> Tot bool
let rec evenb' i =
match i with
| 0 -> true
| 1 -> false
| _ -> evenb' (i-2)
val oddb : nat -> Tot bool
let oddb n = not (evenb n)
val test_filter1 : unit -> Lemma
(ensures (filter evenb [1;2;3;4] = [2;4]))
let test_filter1 () = ()
val test_filter2 : unit -> Lemma
(ensures (filter evenb' [1;2;3;4] = [2;4]))
let test_filter2 () = ()
(* Map *)
val map : ('a->Tot 'b) -> (list 'a) -> Tot (list 'b)
let rec map f l =
match l with
| [] -> []
| h :: t -> (f h) :: (map f t)
val test_map1 : unit -> Lemma
(ensures (map (fun n -> n + 3) [2;0;2] = [5;3;5]))
let test_map1 () = ()
val test_map2 : unit -> Lemma
(ensures (map oddb [2;1;2;5] = [false;true;false;true]))
let test_map2 () = ()
val test_map3 : unit -> Lemma
(ensures (map (fun n -> [evenb n;oddb n]) [2;1;2;5]
= [[true;false];[false;true];[true;false];[false;true]]))
let test_map3 () = ()
val map_snoc : f:('a->Tot 'b) -> x:'a -> l:list 'a -> Lemma
(ensures (map f (snoc l x) == snoc (map f l) (f x)))
let rec map_snoc f x l =
match l with
| [] -> ()
| h::t -> map_snoc f x t
val map_rev : f:('a->Tot 'b) -> l:(list 'a) -> Lemma
(ensures (map f (rev l) == rev (map f l)))
let rec map_rev f l =
match l with
| [] -> ()
| h::t -> map_snoc f h (rev t); map_rev f t
(* Map for options *)
val option_map : ('a -> Tot 'b) -> option 'a -> Tot (option 'b)
let option_map f o =
match o with
| None -> None
| Some a -> Some (f a)
(* Fold *)
val fold : (f : 'a -> 'b -> Tot 'b) -> list 'a -> 'b -> Tot 'b
let rec fold f l b =
match l with
| [] -> b
| h::t -> f h (fold f t b)
val fold_example1 : unit -> Lemma
(ensures (let open FStar.Mul in
fold (fun x y -> x * y) [1;2;3;4] 1 = 24))
let fold_example1 () = ()
val fold_example2 : unit -> Lemma
(ensures (fold (fun x y -> x && y) [true;true;false;true] true = false))
let fold_example2 () = ()
val fold_example3 : unit -> Lemma
(ensures (fold app [[1];[];[2;3];[4]] [] = [1;2;3;4]))
let fold_example3 () = ()
(* Functions For Constructing Functions *)
val constfun : 'a -> 'b -> Tot 'a
let constfun x _ = x
val ftrue : 'b -> Tot bool
(* This should work, but it doesn't: causes failed postconditions later on
let ftrue = constfun true *)
let ftrue _ = true
(* CH: This causes syntax error at character 12, is override a
keyword?
NS: Yes, override is a keyword. Only because it is a keyword in F#,
and since we (plan to) codegen to F# and Caml, unless we mangle
names, we inherit their keywords.
val override : ('a -> Tot 'b) -> 'a -> 'b -> 'a -> Tot 'b
*)
val my_override : #a:eqtype -> #b:Type -> (a -> Tot b) -> a -> b -> a -> Tot b
let my_override #a #b f k x k' = if k = k' then x else f k'
val fmostlytrue : int -> Tot bool
let fmostlytrue x = my_override (my_override ftrue 1 false) 3 false x
(* CH: these fail, too higher order? *)
(* NS: Not any more ... need to make currying explicit *)
(* CH: That's counter intuitive. I fail to see the
difference between implicit and explicit currying.
Isn't one just syntax sugar for the other? *)
val override_example1 : unit -> Lemma
(ensures (fmostlytrue 0 = true))
let override_example1 () = ()
val override_example2 : unit -> Lemma
(ensures (fmostlytrue 1 = false))
let override_example2 () = ()
val override_example3 : unit -> Lemma
(ensures (fmostlytrue 2 = true))
let override_example3 () = ()
val override_example4 : unit -> Lemma
(ensures (fmostlytrue 3 = false))
let override_example4 () = ()
val override_eq : #a:Type -> #b:eqtype -> x:a -> k:b -> f:(b->Tot a) -> Lemma
(ensures ((my_override f k x) k == x))
let override_eq #a #b x k f = ()
val override_neq : #a:Type -> #b:eqtype
-> x1:a -> x2:a -> k1:b -> k2:b -> f:(b->Tot a) -> Pure unit
(requires (f k1 == x1 /\ ~(k2 == k1)))
(ensures (fun r -> (my_override f k2 x2) k1 == x1))
let override_neq #a #b x1 x2 k1 k2 f = ()
(* NS: Experimenting first with named functions *)
val plus_one: 'a -> nat -> Tot nat
let plus_one m n = n + 1
val fold_length_named : l:list 'a -> Tot nat
let fold_length_named l = fold plus_one l 0
val fold_length_named_correct : l:list 'a -> Lemma
(ensures (fold_length_named l = length l))
let rec fold_length_named_correct l =
match l with
| [] -> ()
| h::t -> fold_length_named_correct t
(* NS: But, with named functions, you have to explicitly closure-convert ...
and the closure arguments have to be explicitly curried ... yuck *)
val fcons : ('a -> Tot 'b) -> 'a -> list 'b -> Tot (list 'b)
let fcons f x l = f x :: l
val fold_map_named : ('a->Tot 'b) -> list 'a -> Tot (list 'b)
let fold_map_named f l= fold (fcons f) l []
(* But it works *)
val fold_map_named_correct : f:('a->Tot 'b) -> l:list 'a -> Lemma | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": false,
"source_file": "SfPoly.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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 | f: (_: 'a -> 'b) -> l: Prims.list 'a
-> FStar.Pervasives.Lemma (ensures SfPoly.fold_map_named f l == SfPoly.map f l) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.list",
"SfPoly.fold_map_named_correct",
"Prims.unit"
] | [
"recursion"
] | false | false | true | false | false | let rec fold_map_named_correct f l =
| match l with
| [] -> ()
| h :: t -> fold_map_named_correct f t | false |
Pulse.Lib.CancellableInvariant.fst | Pulse.Lib.CancellableInvariant.token | val token : Type0 | let token = GR.ref bool | {
"file_name": "share/steel/examples/pulse/lib/Pulse.Lib.CancellableInvariant.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 23,
"end_line": 6,
"start_col": 0,
"start_line": 6
} | module Pulse.Lib.CancellableInvariant
open Pulse.Lib.Pervasives
module GR = Pulse.Lib.GhostReference | {
"checked_file": "/",
"dependencies": [
"Pulse.Lib.Pervasives.fst.checked",
"Pulse.Lib.GhostReference.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Lib.CancellableInvariant.fst"
} | [
{
"abbrev": true,
"full_module": "Pulse.Lib.GhostReference",
"short_module": "GR"
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.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": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type0 | Prims.Tot | [
"total"
] | [] | [
"Pulse.Lib.GhostReference.ref",
"Prims.bool"
] | [] | false | false | false | true | true | let token =
| GR.ref bool | false |
|
Pulse.Lib.CancellableInvariant.fst | Pulse.Lib.CancellableInvariant.cancellable | val cancellable : t: Pulse.Lib.CancellableInvariant.token -> v: Pulse.Lib.Core.vprop -> Pulse.Lib.Core.vprop | let cancellable (t:token) (v:vprop) =
exists* b.
maybe b v **
GR.pts_to t #(half_perm full_perm) b | {
"file_name": "share/steel/examples/pulse/lib/Pulse.Lib.CancellableInvariant.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 44,
"end_line": 13,
"start_col": 0,
"start_line": 10
} | module Pulse.Lib.CancellableInvariant
open Pulse.Lib.Pervasives
module GR = Pulse.Lib.GhostReference
[@@erasable]
let token = GR.ref bool
let maybe b v = if b then v else emp | {
"checked_file": "/",
"dependencies": [
"Pulse.Lib.Pervasives.fst.checked",
"Pulse.Lib.GhostReference.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Lib.CancellableInvariant.fst"
} | [
{
"abbrev": true,
"full_module": "Pulse.Lib.GhostReference",
"short_module": "GR"
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.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": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: Pulse.Lib.CancellableInvariant.token -> v: Pulse.Lib.Core.vprop -> Pulse.Lib.Core.vprop | Prims.Tot | [
"total"
] | [] | [
"Pulse.Lib.CancellableInvariant.token",
"Pulse.Lib.Core.vprop",
"Pulse.Lib.Core.op_exists_Star",
"Prims.bool",
"Pulse.Lib.Core.op_Star_Star",
"Pulse.Lib.CancellableInvariant.maybe",
"Pulse.Lib.GhostReference.pts_to",
"PulseCore.FractionalPermission.half_perm",
"PulseCore.FractionalPermission.full_perm"
] | [] | false | false | false | true | false | let cancellable (t: token) (v: vprop) =
| exists* b. maybe b v ** GR.pts_to t #(half_perm full_perm) b | false |
|
Pulse.Lib.CancellableInvariant.fst | Pulse.Lib.CancellableInvariant.active | val active (p: perm) (c: token) : vprop | val active (p: perm) (c: token) : vprop | let active (p:perm) (c:token)
: vprop
= GR.pts_to c #(half_perm p) true | {
"file_name": "share/steel/examples/pulse/lib/Pulse.Lib.CancellableInvariant.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 35,
"end_line": 17,
"start_col": 0,
"start_line": 15
} | module Pulse.Lib.CancellableInvariant
open Pulse.Lib.Pervasives
module GR = Pulse.Lib.GhostReference
[@@erasable]
let token = GR.ref bool
let maybe b v = if b then v else emp
let cancellable (t:token) (v:vprop) =
exists* b.
maybe b v **
GR.pts_to t #(half_perm full_perm) b | {
"checked_file": "/",
"dependencies": [
"Pulse.Lib.Pervasives.fst.checked",
"Pulse.Lib.GhostReference.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Lib.CancellableInvariant.fst"
} | [
{
"abbrev": true,
"full_module": "Pulse.Lib.GhostReference",
"short_module": "GR"
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.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": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | p: PulseCore.FractionalPermission.perm -> c: Pulse.Lib.CancellableInvariant.token
-> Pulse.Lib.Core.vprop | Prims.Tot | [
"total"
] | [] | [
"PulseCore.FractionalPermission.perm",
"Pulse.Lib.CancellableInvariant.token",
"Pulse.Lib.GhostReference.pts_to",
"Prims.bool",
"PulseCore.FractionalPermission.half_perm",
"Pulse.Lib.Core.vprop"
] | [] | false | false | false | true | false | let active (p: perm) (c: token) : vprop =
| GR.pts_to c #(half_perm p) true | false |
Pulse.Lib.CancellableInvariant.fst | Pulse.Lib.CancellableInvariant.maybe | val maybe : b: Prims.bool -> v: Pulse.Lib.Core.vprop -> Pulse.Lib.Core.vprop | let maybe b v = if b then v else emp | {
"file_name": "share/steel/examples/pulse/lib/Pulse.Lib.CancellableInvariant.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 36,
"end_line": 8,
"start_col": 0,
"start_line": 8
} | module Pulse.Lib.CancellableInvariant
open Pulse.Lib.Pervasives
module GR = Pulse.Lib.GhostReference
[@@erasable]
let token = GR.ref bool | {
"checked_file": "/",
"dependencies": [
"Pulse.Lib.Pervasives.fst.checked",
"Pulse.Lib.GhostReference.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Lib.CancellableInvariant.fst"
} | [
{
"abbrev": true,
"full_module": "Pulse.Lib.GhostReference",
"short_module": "GR"
},
{
"abbrev": false,
"full_module": "Pulse.Lib.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.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": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | b: Prims.bool -> v: Pulse.Lib.Core.vprop -> Pulse.Lib.Core.vprop | Prims.Tot | [
"total"
] | [] | [
"Prims.bool",
"Pulse.Lib.Core.vprop",
"Pulse.Lib.Core.emp"
] | [] | false | false | false | true | false | let maybe b v =
| if b then v else emp | false |
|
References.fst | References.swap_selector | val swap_selector (#a: Type0) (r1 r2: ref a)
: Steel unit
((vptr r1) `star` (vptr r2))
(fun _ -> (vptr r1) `star` (vptr r2))
(requires fun _ -> True)
(ensures fun h0 _ h1 -> sel r1 h0 == sel r2 h1 /\ sel r2 h0 == sel r1 h1) | val swap_selector (#a: Type0) (r1 r2: ref a)
: Steel unit
((vptr r1) `star` (vptr r2))
(fun _ -> (vptr r1) `star` (vptr r2))
(requires fun _ -> True)
(ensures fun h0 _ h1 -> sel r1 h0 == sel r2 h1 /\ sel r2 h0 == sel r1 h1) | let swap_selector (#a:Type0) (r1 r2:ref a) : Steel unit
(vptr r1 `star` vptr r2)
(fun _ -> vptr r1 `star` vptr r2)
(requires fun _ -> True)
(ensures fun h0 _ h1 ->
sel r1 h0 == sel r2 h1 /\
sel r2 h0 == sel r1 h1)
= let x1 = read r1 in
let x2 = read r2 in
write r2 x1;
write r1 x2 | {
"file_name": "share/steel/tutorial/References.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 15,
"end_line": 38,
"start_col": 0,
"start_line": 28
} | module References
open FStar.Ghost
open Steel.FractionalPermission
open Steel.Effect.Atomic
open Steel.Effect
open Steel.Reference
/// Some examples using Steel references with fractional permissions
#push-options "--fuel 0 --ifuel 0 --ide_id_info_off"
(** Swap examples **)
/// The textbook separation logic swap, with the standard pts_to assertion
let swap_textbook (#a:Type0) (r1 r2:ref a) (v1 v2:erased a) : SteelT unit
(pts_to r1 full_perm v1 `star` pts_to r2 full_perm v2)
(fun _ -> pts_to r1 full_perm v2 `star` pts_to r2 full_perm v1)
= let x1 = read_pt r1 in
let x2 = read_pt r2 in
write_pt r1 x2;
write_pt r2 x1;
// The extra trailing unit is a needed to trigger smt rewriting of x1 into v1 and x2 into v2
// It might be solved once we have smt_rewrites in subcomp
() | {
"checked_file": "/",
"dependencies": [
"Steel.Reference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "References.fst"
} | [
{
"abbrev": false,
"full_module": "Steel.Reference",
"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.FractionalPermission",
"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": 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": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | r1: Steel.Reference.ref a -> r2: Steel.Reference.ref a -> Steel.Effect.Steel Prims.unit | Steel.Effect.Steel | [] | [] | [
"Steel.Reference.ref",
"Steel.Reference.write",
"Prims.unit",
"Steel.Reference.read",
"Steel.Effect.Common.star",
"Steel.Reference.vptr",
"Steel.Effect.Common.vprop",
"Steel.Effect.Common.rmem",
"Prims.l_True",
"Prims.l_and",
"Prims.eq2",
"Steel.Effect.Common.normal",
"Steel.Effect.Common.t_of",
"Steel.Reference.sel"
] | [] | false | true | false | false | false | let swap_selector (#a: Type0) (r1 r2: ref a)
: Steel unit
((vptr r1) `star` (vptr r2))
(fun _ -> (vptr r1) `star` (vptr r2))
(requires fun _ -> True)
(ensures fun h0 _ h1 -> sel r1 h0 == sel r2 h1 /\ sel r2 h0 == sel r1 h1) =
| let x1 = read r1 in
let x2 = read r2 in
write r2 x1;
write r1 x2 | false |
References.fst | References.main_ref | val main_ref: Prims.unit
-> Steel int emp (fun _ -> emp) (requires fun _ -> True) (ensures fun _ x _ -> x == 1) | val main_ref: Prims.unit
-> Steel int emp (fun _ -> emp) (requires fun _ -> True) (ensures fun _ x _ -> x == 1) | let main_ref () : Steel int emp (fun _ -> emp)
(requires fun _ -> True)
(ensures fun _ x _ -> x == 1)
= // Allocating reference r
let r = malloc 0 in
// Writing value 2 in the newly allocated reference
write r 2;
// Reading value of r in memory. This was set to 2 just above
let v = read r in
// Freeing reference r
free r;
// The returned value is equal to 1, the context is now empty
v - 1 | {
"file_name": "share/steel/tutorial/References.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 9,
"end_line": 56,
"start_col": 0,
"start_line": 44
} | module References
open FStar.Ghost
open Steel.FractionalPermission
open Steel.Effect.Atomic
open Steel.Effect
open Steel.Reference
/// Some examples using Steel references with fractional permissions
#push-options "--fuel 0 --ifuel 0 --ide_id_info_off"
(** Swap examples **)
/// The textbook separation logic swap, with the standard pts_to assertion
let swap_textbook (#a:Type0) (r1 r2:ref a) (v1 v2:erased a) : SteelT unit
(pts_to r1 full_perm v1 `star` pts_to r2 full_perm v2)
(fun _ -> pts_to r1 full_perm v2 `star` pts_to r2 full_perm v1)
= let x1 = read_pt r1 in
let x2 = read_pt r2 in
write_pt r1 x2;
write_pt r2 x1;
// The extra trailing unit is a needed to trigger smt rewriting of x1 into v1 and x2 into v2
// It might be solved once we have smt_rewrites in subcomp
()
/// A selector version of swap, more idiomatic in Steel
let swap_selector (#a:Type0) (r1 r2:ref a) : Steel unit
(vptr r1 `star` vptr r2)
(fun _ -> vptr r1 `star` vptr r2)
(requires fun _ -> True)
(ensures fun h0 _ h1 ->
sel r1 h0 == sel r2 h1 /\
sel r2 h0 == sel r1 h1)
= let x1 = read r1 in
let x2 = read r2 in
write r2 x1;
write r1 x2
(** Allocating and Freeing references *) | {
"checked_file": "/",
"dependencies": [
"Steel.Reference.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"Steel.Effect.Atomic.fsti.checked",
"Steel.Effect.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "References.fst"
} | [
{
"abbrev": false,
"full_module": "Steel.Reference",
"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.FractionalPermission",
"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": 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": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.unit -> Steel.Effect.Steel Prims.int | Steel.Effect.Steel | [] | [] | [
"Prims.unit",
"Prims.op_Subtraction",
"Prims.int",
"Steel.Reference.free",
"Steel.Reference.read",
"Steel.Reference.write",
"Steel.Reference.ref",
"Steel.Reference.malloc",
"Steel.Effect.Common.emp",
"Steel.Effect.Common.vprop",
"Steel.Effect.Common.rmem",
"Prims.l_True",
"Prims.eq2"
] | [] | false | true | false | false | false | let main_ref ()
: Steel int emp (fun _ -> emp) (requires fun _ -> True) (ensures fun _ x _ -> x == 1) =
| let r = malloc 0 in
write r 2;
let v = read r in
free r;
v - 1 | false |
Test.Vectors.Poly1305.fst | Test.Vectors.Poly1305.input21 | val input21:(b: B.buffer UInt8.t {B.length b = 528 /\ B.recallable b}) | val input21:(b: B.buffer UInt8.t {B.length b = 528 /\ B.recallable b}) | let input21: (b: B.buffer UInt8.t { B.length b = 528 /\ B.recallable b }) =
[@inline_let] let l = [ 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x0buy; 0x17uy; 0x03uy; 0x03uy; 0x02uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x06uy; 0xdbuy; 0x1fuy; 0x1fuy; 0x36uy; 0x8duy; 0x69uy; 0x6auy; 0x81uy; 0x0auy; 0x34uy; 0x9cuy; 0x0cuy; 0x71uy; 0x4cuy; 0x9auy; 0x5euy; 0x78uy; 0x50uy; 0xc2uy; 0x40uy; 0x7duy; 0x72uy; 0x1auy; 0xcduy; 0xeduy; 0x95uy; 0xe0uy; 0x18uy; 0xd7uy; 0xa8uy; 0x52uy; 0x66uy; 0xa6uy; 0xe1uy; 0x28uy; 0x9cuy; 0xdbuy; 0x4auy; 0xebuy; 0x18uy; 0xdauy; 0x5auy; 0xc8uy; 0xa2uy; 0xb0uy; 0x02uy; 0x6duy; 0x24uy; 0xa5uy; 0x9auy; 0xd4uy; 0x85uy; 0x22uy; 0x7fuy; 0x3euy; 0xaeuy; 0xdbuy; 0xb2uy; 0xe7uy; 0xe3uy; 0x5euy; 0x1cuy; 0x66uy; 0xcduy; 0x60uy; 0xf9uy; 0xabuy; 0xf7uy; 0x16uy; 0xdcuy; 0xc9uy; 0xacuy; 0x42uy; 0x68uy; 0x2duy; 0xd7uy; 0xdauy; 0xb2uy; 0x87uy; 0xa7uy; 0x02uy; 0x4cuy; 0x4euy; 0xefuy; 0xc3uy; 0x21uy; 0xccuy; 0x05uy; 0x74uy; 0xe1uy; 0x67uy; 0x93uy; 0xe3uy; 0x7cuy; 0xecuy; 0x03uy; 0xc5uy; 0xbduy; 0xa4uy; 0x2buy; 0x54uy; 0xc1uy; 0x14uy; 0xa8uy; 0x0buy; 0x57uy; 0xafuy; 0x26uy; 0x41uy; 0x6cuy; 0x7buy; 0xe7uy; 0x42uy; 0x00uy; 0x5euy; 0x20uy; 0x85uy; 0x5cuy; 0x73uy; 0xe2uy; 0x1duy; 0xc8uy; 0xe2uy; 0xeduy; 0xc9uy; 0xd4uy; 0x35uy; 0xcbuy; 0x6fuy; 0x60uy; 0x59uy; 0x28uy; 0x00uy; 0x11uy; 0xc2uy; 0x70uy; 0xb7uy; 0x15uy; 0x70uy; 0x05uy; 0x1cuy; 0x1cuy; 0x9buy; 0x30uy; 0x52uy; 0x12uy; 0x66uy; 0x20uy; 0xbcuy; 0x1euy; 0x27uy; 0x30uy; 0xfauy; 0x06uy; 0x6cuy; 0x7auy; 0x50uy; 0x9duy; 0x53uy; 0xc6uy; 0x0euy; 0x5auy; 0xe1uy; 0xb4uy; 0x0auy; 0xa6uy; 0xe3uy; 0x9euy; 0x49uy; 0x66uy; 0x92uy; 0x28uy; 0xc9uy; 0x0euy; 0xecuy; 0xb4uy; 0xa5uy; 0x0duy; 0xb3uy; 0x2auy; 0x50uy; 0xbcuy; 0x49uy; 0xe9uy; 0x0buy; 0x4fuy; 0x4buy; 0x35uy; 0x9auy; 0x1duy; 0xfduy; 0x11uy; 0x74uy; 0x9cuy; 0xd3uy; 0x86uy; 0x7fuy; 0xcfuy; 0x2fuy; 0xb7uy; 0xbbuy; 0x6cuy; 0xd4uy; 0x73uy; 0x8fuy; 0x6auy; 0x4auy; 0xd6uy; 0xf7uy; 0xcauy; 0x50uy; 0x58uy; 0xf7uy; 0x61uy; 0x88uy; 0x45uy; 0xafuy; 0x9fuy; 0x02uy; 0x0fuy; 0x6cuy; 0x3buy; 0x96uy; 0x7buy; 0x8fuy; 0x4cuy; 0xd4uy; 0xa9uy; 0x1euy; 0x28uy; 0x13uy; 0xb5uy; 0x07uy; 0xaeuy; 0x66uy; 0xf2uy; 0xd3uy; 0x5cuy; 0x18uy; 0x28uy; 0x4fuy; 0x72uy; 0x92uy; 0x18uy; 0x60uy; 0x62uy; 0xe1uy; 0x0fuy; 0xd5uy; 0x51uy; 0x0duy; 0x18uy; 0x77uy; 0x53uy; 0x51uy; 0xefuy; 0x33uy; 0x4euy; 0x76uy; 0x34uy; 0xabuy; 0x47uy; 0x43uy; 0xf5uy; 0xb6uy; 0x8fuy; 0x49uy; 0xaduy; 0xcauy; 0xb3uy; 0x84uy; 0xd3uy; 0xfduy; 0x75uy; 0xf7uy; 0x39uy; 0x0fuy; 0x40uy; 0x06uy; 0xefuy; 0x2auy; 0x29uy; 0x5cuy; 0x8cuy; 0x7auy; 0x07uy; 0x6auy; 0xd5uy; 0x45uy; 0x46uy; 0xcduy; 0x25uy; 0xd2uy; 0x10uy; 0x7fuy; 0xbeuy; 0x14uy; 0x36uy; 0xc8uy; 0x40uy; 0x92uy; 0x4auy; 0xaeuy; 0xbeuy; 0x5buy; 0x37uy; 0x08uy; 0x93uy; 0xcduy; 0x63uy; 0xd1uy; 0x32uy; 0x5buy; 0x86uy; 0x16uy; 0xfcuy; 0x48uy; 0x10uy; 0x88uy; 0x6buy; 0xc1uy; 0x52uy; 0xc5uy; 0x32uy; 0x21uy; 0xb6uy; 0xdfuy; 0x37uy; 0x31uy; 0x19uy; 0x39uy; 0x32uy; 0x55uy; 0xeeuy; 0x72uy; 0xbcuy; 0xaauy; 0x88uy; 0x01uy; 0x74uy; 0xf1uy; 0x71uy; 0x7fuy; 0x91uy; 0x84uy; 0xfauy; 0x91uy; 0x64uy; 0x6fuy; 0x17uy; 0xa2uy; 0x4auy; 0xc5uy; 0x5duy; 0x16uy; 0xbfuy; 0xdduy; 0xcauy; 0x95uy; 0x81uy; 0xa9uy; 0x2euy; 0xdauy; 0x47uy; 0x92uy; 0x01uy; 0xf0uy; 0xeduy; 0xbfuy; 0x63uy; 0x36uy; 0x00uy; 0xd6uy; 0x06uy; 0x6duy; 0x1auy; 0xb3uy; 0x6duy; 0x5duy; 0x24uy; 0x15uy; 0xd7uy; 0x13uy; 0x51uy; 0xbbuy; 0xcduy; 0x60uy; 0x8auy; 0x25uy; 0x10uy; 0x8duy; 0x25uy; 0x64uy; 0x19uy; 0x92uy; 0xc1uy; 0xf2uy; 0x6cuy; 0x53uy; 0x1cuy; 0xf9uy; 0xf9uy; 0x02uy; 0x03uy; 0xbcuy; 0x4cuy; 0xc1uy; 0x9fuy; 0x59uy; 0x27uy; 0xd8uy; 0x34uy; 0xb0uy; 0xa4uy; 0x71uy; 0x16uy; 0xd3uy; 0x88uy; 0x4buy; 0xbbuy; 0x16uy; 0x4buy; 0x8euy; 0xc8uy; 0x83uy; 0xd1uy; 0xacuy; 0x83uy; 0x2euy; 0x56uy; 0xb3uy; 0x91uy; 0x8auy; 0x98uy; 0x60uy; 0x1auy; 0x08uy; 0xd1uy; 0x71uy; 0x88uy; 0x15uy; 0x41uy; 0xd5uy; 0x94uy; 0xdbuy; 0x39uy; 0x9cuy; 0x6auy; 0xe6uy; 0x15uy; 0x12uy; 0x21uy; 0x74uy; 0x5auy; 0xecuy; 0x81uy; 0x4cuy; 0x45uy; 0xb0uy; 0xb0uy; 0x5buy; 0x56uy; 0x54uy; 0x36uy; 0xfduy; 0x6fuy; 0x13uy; 0x7auy; 0xa1uy; 0x0auy; 0x0cuy; 0x0buy; 0x64uy; 0x37uy; 0x61uy; 0xdbuy; 0xd6uy; 0xf9uy; 0xa9uy; 0xdcuy; 0xb9uy; 0x9buy; 0x1auy; 0x6euy; 0x69uy; 0x08uy; 0x54uy; 0xceuy; 0x07uy; 0x69uy; 0xcduy; 0xe3uy; 0x97uy; 0x61uy; 0xd8uy; 0x2fuy; 0xcduy; 0xecuy; 0x15uy; 0xf0uy; 0xd9uy; 0x2duy; 0x7duy; 0x8euy; 0x94uy; 0xaduy; 0xe8uy; 0xebuy; 0x83uy; 0xfbuy; 0xe0uy; ] in
assert_norm (List.Tot.length l = 528);
B.gcmalloc_of_list HyperStack.root l | {
"file_name": "providers/test/vectors/Test.Vectors.Poly1305.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 38,
"end_line": 514,
"start_col": 0,
"start_line": 511
} | module Test.Vectors.Poly1305
module B = LowStar.Buffer
#set-options "--max_fuel 0 --max_ifuel 0"
let input0: (b: B.buffer UInt8.t { B.length b = 34 /\ B.recallable b }) =
[@inline_let] let l = [ 0x43uy; 0x72uy; 0x79uy; 0x70uy; 0x74uy; 0x6fuy; 0x67uy; 0x72uy; 0x61uy; 0x70uy; 0x68uy; 0x69uy; 0x63uy; 0x20uy; 0x46uy; 0x6fuy; 0x72uy; 0x75uy; 0x6duy; 0x20uy; 0x52uy; 0x65uy; 0x73uy; 0x65uy; 0x61uy; 0x72uy; 0x63uy; 0x68uy; 0x20uy; 0x47uy; 0x72uy; 0x6fuy; 0x75uy; 0x70uy; ] in
assert_norm (List.Tot.length l = 34);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input0_len: (x:UInt32.t { UInt32.v x = B.length input0 }) =
34ul
let key0: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x85uy; 0xd6uy; 0xbeuy; 0x78uy; 0x57uy; 0x55uy; 0x6duy; 0x33uy; 0x7fuy; 0x44uy; 0x52uy; 0xfeuy; 0x42uy; 0xd5uy; 0x06uy; 0xa8uy; 0x01uy; 0x03uy; 0x80uy; 0x8auy; 0xfbuy; 0x0duy; 0xb2uy; 0xfduy; 0x4auy; 0xbfuy; 0xf6uy; 0xafuy; 0x41uy; 0x49uy; 0xf5uy; 0x1buy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key0_len: (x:UInt32.t { UInt32.v x = B.length key0 }) =
32ul
let tag0: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0xa8uy; 0x06uy; 0x1duy; 0xc1uy; 0x30uy; 0x51uy; 0x36uy; 0xc6uy; 0xc2uy; 0x2buy; 0x8buy; 0xafuy; 0x0cuy; 0x01uy; 0x27uy; 0xa9uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag0_len: (x:UInt32.t { UInt32.v x = B.length tag0 }) =
16ul
let input1: (b: B.buffer UInt8.t { B.length b = 2 /\ B.recallable b }) =
[@inline_let] let l = [ 0xf3uy; 0xf6uy; ] in
assert_norm (List.Tot.length l = 2);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input1_len: (x:UInt32.t { UInt32.v x = B.length input1 }) =
2ul
let key1: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x85uy; 0x1fuy; 0xc4uy; 0x0cuy; 0x34uy; 0x67uy; 0xacuy; 0x0buy; 0xe0uy; 0x5cuy; 0xc2uy; 0x04uy; 0x04uy; 0xf3uy; 0xf7uy; 0x00uy; 0x58uy; 0x0buy; 0x3buy; 0x0fuy; 0x94uy; 0x47uy; 0xbbuy; 0x1euy; 0x69uy; 0xd0uy; 0x95uy; 0xb5uy; 0x92uy; 0x8buy; 0x6duy; 0xbcuy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key1_len: (x:UInt32.t { UInt32.v x = B.length key1 }) =
32ul
let tag1: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0xf4uy; 0xc6uy; 0x33uy; 0xc3uy; 0x04uy; 0x4fuy; 0xc1uy; 0x45uy; 0xf8uy; 0x4fuy; 0x33uy; 0x5cuy; 0xb8uy; 0x19uy; 0x53uy; 0xdeuy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag1_len: (x:UInt32.t { UInt32.v x = B.length tag1 }) =
16ul
let input2: (b: B.buffer UInt8.t { B.length b = 0 /\ B.recallable b }) =
[@inline_let] let l = [ ] in
assert_norm (List.Tot.length l = 0);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input2_len: (x:UInt32.t { UInt32.v x = B.length input2 }) =
0ul
let key2: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0xa0uy; 0xf3uy; 0x08uy; 0x00uy; 0x00uy; 0xf4uy; 0x64uy; 0x00uy; 0xd0uy; 0xc7uy; 0xe9uy; 0x07uy; 0x6cuy; 0x83uy; 0x44uy; 0x03uy; 0xdduy; 0x3fuy; 0xabuy; 0x22uy; 0x51uy; 0xf1uy; 0x1auy; 0xc7uy; 0x59uy; 0xf0uy; 0x88uy; 0x71uy; 0x29uy; 0xccuy; 0x2euy; 0xe7uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key2_len: (x:UInt32.t { UInt32.v x = B.length key2 }) =
32ul
let tag2: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0xdduy; 0x3fuy; 0xabuy; 0x22uy; 0x51uy; 0xf1uy; 0x1auy; 0xc7uy; 0x59uy; 0xf0uy; 0x88uy; 0x71uy; 0x29uy; 0xccuy; 0x2euy; 0xe7uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag2_len: (x:UInt32.t { UInt32.v x = B.length tag2 }) =
16ul
let input3: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x66uy; 0x3cuy; 0xeauy; 0x19uy; 0x0fuy; 0xfbuy; 0x83uy; 0xd8uy; 0x95uy; 0x93uy; 0xf3uy; 0xf4uy; 0x76uy; 0xb6uy; 0xbcuy; 0x24uy; 0xd7uy; 0xe6uy; 0x79uy; 0x10uy; 0x7euy; 0xa2uy; 0x6auy; 0xdbuy; 0x8cuy; 0xafuy; 0x66uy; 0x52uy; 0xd0uy; 0x65uy; 0x61uy; 0x36uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input3_len: (x:UInt32.t { UInt32.v x = B.length input3 }) =
32ul
let key3: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x48uy; 0x44uy; 0x3duy; 0x0buy; 0xb0uy; 0xd2uy; 0x11uy; 0x09uy; 0xc8uy; 0x9auy; 0x10uy; 0x0buy; 0x5cuy; 0xe2uy; 0xc2uy; 0x08uy; 0x83uy; 0x14uy; 0x9cuy; 0x69uy; 0xb5uy; 0x61uy; 0xdduy; 0x88uy; 0x29uy; 0x8auy; 0x17uy; 0x98uy; 0xb1uy; 0x07uy; 0x16uy; 0xefuy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key3_len: (x:UInt32.t { UInt32.v x = B.length key3 }) =
32ul
let tag3: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0x0euy; 0xe1uy; 0xc1uy; 0x6buy; 0xb7uy; 0x3fuy; 0x0fuy; 0x4fuy; 0xd1uy; 0x98uy; 0x81uy; 0x75uy; 0x3cuy; 0x01uy; 0xcduy; 0xbeuy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag3_len: (x:UInt32.t { UInt32.v x = B.length tag3 }) =
16ul
let input4: (b: B.buffer UInt8.t { B.length b = 63 /\ B.recallable b }) =
[@inline_let] let l = [ 0xabuy; 0x08uy; 0x12uy; 0x72uy; 0x4auy; 0x7fuy; 0x1euy; 0x34uy; 0x27uy; 0x42uy; 0xcbuy; 0xeduy; 0x37uy; 0x4duy; 0x94uy; 0xd1uy; 0x36uy; 0xc6uy; 0xb8uy; 0x79uy; 0x5duy; 0x45uy; 0xb3uy; 0x81uy; 0x98uy; 0x30uy; 0xf2uy; 0xc0uy; 0x44uy; 0x91uy; 0xfauy; 0xf0uy; 0x99uy; 0x0cuy; 0x62uy; 0xe4uy; 0x8buy; 0x80uy; 0x18uy; 0xb2uy; 0xc3uy; 0xe4uy; 0xa0uy; 0xfauy; 0x31uy; 0x34uy; 0xcbuy; 0x67uy; 0xfauy; 0x83uy; 0xe1uy; 0x58uy; 0xc9uy; 0x94uy; 0xd9uy; 0x61uy; 0xc4uy; 0xcbuy; 0x21uy; 0x09uy; 0x5cuy; 0x1buy; 0xf9uy; ] in
assert_norm (List.Tot.length l = 63);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input4_len: (x:UInt32.t { UInt32.v x = B.length input4 }) =
63ul
let key4: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x12uy; 0x97uy; 0x6auy; 0x08uy; 0xc4uy; 0x42uy; 0x6duy; 0x0cuy; 0xe8uy; 0xa8uy; 0x24uy; 0x07uy; 0xc4uy; 0xf4uy; 0x82uy; 0x07uy; 0x80uy; 0xf8uy; 0xc2uy; 0x0auy; 0xa7uy; 0x12uy; 0x02uy; 0xd1uy; 0xe2uy; 0x91uy; 0x79uy; 0xcbuy; 0xcbuy; 0x55uy; 0x5auy; 0x57uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key4_len: (x:UInt32.t { UInt32.v x = B.length key4 }) =
32ul
let tag4: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0x51uy; 0x54uy; 0xaduy; 0x0duy; 0x2cuy; 0xb2uy; 0x6euy; 0x01uy; 0x27uy; 0x4fuy; 0xc5uy; 0x11uy; 0x48uy; 0x49uy; 0x1fuy; 0x1buy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag4_len: (x:UInt32.t { UInt32.v x = B.length tag4 }) =
16ul
let input5: (b: B.buffer UInt8.t { B.length b = 64 /\ B.recallable b }) =
[@inline_let] let l = [ 0xabuy; 0x08uy; 0x12uy; 0x72uy; 0x4auy; 0x7fuy; 0x1euy; 0x34uy; 0x27uy; 0x42uy; 0xcbuy; 0xeduy; 0x37uy; 0x4duy; 0x94uy; 0xd1uy; 0x36uy; 0xc6uy; 0xb8uy; 0x79uy; 0x5duy; 0x45uy; 0xb3uy; 0x81uy; 0x98uy; 0x30uy; 0xf2uy; 0xc0uy; 0x44uy; 0x91uy; 0xfauy; 0xf0uy; 0x99uy; 0x0cuy; 0x62uy; 0xe4uy; 0x8buy; 0x80uy; 0x18uy; 0xb2uy; 0xc3uy; 0xe4uy; 0xa0uy; 0xfauy; 0x31uy; 0x34uy; 0xcbuy; 0x67uy; 0xfauy; 0x83uy; 0xe1uy; 0x58uy; 0xc9uy; 0x94uy; 0xd9uy; 0x61uy; 0xc4uy; 0xcbuy; 0x21uy; 0x09uy; 0x5cuy; 0x1buy; 0xf9uy; 0xafuy; ] in
assert_norm (List.Tot.length l = 64);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input5_len: (x:UInt32.t { UInt32.v x = B.length input5 }) =
64ul
let key5: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x12uy; 0x97uy; 0x6auy; 0x08uy; 0xc4uy; 0x42uy; 0x6duy; 0x0cuy; 0xe8uy; 0xa8uy; 0x24uy; 0x07uy; 0xc4uy; 0xf4uy; 0x82uy; 0x07uy; 0x80uy; 0xf8uy; 0xc2uy; 0x0auy; 0xa7uy; 0x12uy; 0x02uy; 0xd1uy; 0xe2uy; 0x91uy; 0x79uy; 0xcbuy; 0xcbuy; 0x55uy; 0x5auy; 0x57uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key5_len: (x:UInt32.t { UInt32.v x = B.length key5 }) =
32ul
let tag5: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0x81uy; 0x20uy; 0x59uy; 0xa5uy; 0xdauy; 0x19uy; 0x86uy; 0x37uy; 0xcauy; 0xc7uy; 0xc4uy; 0xa6uy; 0x31uy; 0xbeuy; 0xe4uy; 0x66uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag5_len: (x:UInt32.t { UInt32.v x = B.length tag5 }) =
16ul
let input6: (b: B.buffer UInt8.t { B.length b = 48 /\ B.recallable b }) =
[@inline_let] let l = [ 0xabuy; 0x08uy; 0x12uy; 0x72uy; 0x4auy; 0x7fuy; 0x1euy; 0x34uy; 0x27uy; 0x42uy; 0xcbuy; 0xeduy; 0x37uy; 0x4duy; 0x94uy; 0xd1uy; 0x36uy; 0xc6uy; 0xb8uy; 0x79uy; 0x5duy; 0x45uy; 0xb3uy; 0x81uy; 0x98uy; 0x30uy; 0xf2uy; 0xc0uy; 0x44uy; 0x91uy; 0xfauy; 0xf0uy; 0x99uy; 0x0cuy; 0x62uy; 0xe4uy; 0x8buy; 0x80uy; 0x18uy; 0xb2uy; 0xc3uy; 0xe4uy; 0xa0uy; 0xfauy; 0x31uy; 0x34uy; 0xcbuy; 0x67uy; ] in
assert_norm (List.Tot.length l = 48);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input6_len: (x:UInt32.t { UInt32.v x = B.length input6 }) =
48ul
let key6: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x12uy; 0x97uy; 0x6auy; 0x08uy; 0xc4uy; 0x42uy; 0x6duy; 0x0cuy; 0xe8uy; 0xa8uy; 0x24uy; 0x07uy; 0xc4uy; 0xf4uy; 0x82uy; 0x07uy; 0x80uy; 0xf8uy; 0xc2uy; 0x0auy; 0xa7uy; 0x12uy; 0x02uy; 0xd1uy; 0xe2uy; 0x91uy; 0x79uy; 0xcbuy; 0xcbuy; 0x55uy; 0x5auy; 0x57uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key6_len: (x:UInt32.t { UInt32.v x = B.length key6 }) =
32ul
let tag6: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0x5buy; 0x88uy; 0xd7uy; 0xf6uy; 0x22uy; 0x8buy; 0x11uy; 0xe2uy; 0xe2uy; 0x85uy; 0x79uy; 0xa5uy; 0xc0uy; 0xc1uy; 0xf7uy; 0x61uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag6_len: (x:UInt32.t { UInt32.v x = B.length tag6 }) =
16ul
let input7: (b: B.buffer UInt8.t { B.length b = 96 /\ B.recallable b }) =
[@inline_let] let l = [ 0xabuy; 0x08uy; 0x12uy; 0x72uy; 0x4auy; 0x7fuy; 0x1euy; 0x34uy; 0x27uy; 0x42uy; 0xcbuy; 0xeduy; 0x37uy; 0x4duy; 0x94uy; 0xd1uy; 0x36uy; 0xc6uy; 0xb8uy; 0x79uy; 0x5duy; 0x45uy; 0xb3uy; 0x81uy; 0x98uy; 0x30uy; 0xf2uy; 0xc0uy; 0x44uy; 0x91uy; 0xfauy; 0xf0uy; 0x99uy; 0x0cuy; 0x62uy; 0xe4uy; 0x8buy; 0x80uy; 0x18uy; 0xb2uy; 0xc3uy; 0xe4uy; 0xa0uy; 0xfauy; 0x31uy; 0x34uy; 0xcbuy; 0x67uy; 0xfauy; 0x83uy; 0xe1uy; 0x58uy; 0xc9uy; 0x94uy; 0xd9uy; 0x61uy; 0xc4uy; 0xcbuy; 0x21uy; 0x09uy; 0x5cuy; 0x1buy; 0xf9uy; 0xafuy; 0x66uy; 0x3cuy; 0xeauy; 0x19uy; 0x0fuy; 0xfbuy; 0x83uy; 0xd8uy; 0x95uy; 0x93uy; 0xf3uy; 0xf4uy; 0x76uy; 0xb6uy; 0xbcuy; 0x24uy; 0xd7uy; 0xe6uy; 0x79uy; 0x10uy; 0x7euy; 0xa2uy; 0x6auy; 0xdbuy; 0x8cuy; 0xafuy; 0x66uy; 0x52uy; 0xd0uy; 0x65uy; 0x61uy; 0x36uy; ] in
assert_norm (List.Tot.length l = 96);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input7_len: (x:UInt32.t { UInt32.v x = B.length input7 }) =
96ul
let key7: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x12uy; 0x97uy; 0x6auy; 0x08uy; 0xc4uy; 0x42uy; 0x6duy; 0x0cuy; 0xe8uy; 0xa8uy; 0x24uy; 0x07uy; 0xc4uy; 0xf4uy; 0x82uy; 0x07uy; 0x80uy; 0xf8uy; 0xc2uy; 0x0auy; 0xa7uy; 0x12uy; 0x02uy; 0xd1uy; 0xe2uy; 0x91uy; 0x79uy; 0xcbuy; 0xcbuy; 0x55uy; 0x5auy; 0x57uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key7_len: (x:UInt32.t { UInt32.v x = B.length key7 }) =
32ul
let tag7: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0xbbuy; 0xb6uy; 0x13uy; 0xb2uy; 0xb6uy; 0xd7uy; 0x53uy; 0xbauy; 0x07uy; 0x39uy; 0x5buy; 0x91uy; 0x6auy; 0xaeuy; 0xceuy; 0x15uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag7_len: (x:UInt32.t { UInt32.v x = B.length tag7 }) =
16ul
let input8: (b: B.buffer UInt8.t { B.length b = 112 /\ B.recallable b }) =
[@inline_let] let l = [ 0xabuy; 0x08uy; 0x12uy; 0x72uy; 0x4auy; 0x7fuy; 0x1euy; 0x34uy; 0x27uy; 0x42uy; 0xcbuy; 0xeduy; 0x37uy; 0x4duy; 0x94uy; 0xd1uy; 0x36uy; 0xc6uy; 0xb8uy; 0x79uy; 0x5duy; 0x45uy; 0xb3uy; 0x81uy; 0x98uy; 0x30uy; 0xf2uy; 0xc0uy; 0x44uy; 0x91uy; 0xfauy; 0xf0uy; 0x99uy; 0x0cuy; 0x62uy; 0xe4uy; 0x8buy; 0x80uy; 0x18uy; 0xb2uy; 0xc3uy; 0xe4uy; 0xa0uy; 0xfauy; 0x31uy; 0x34uy; 0xcbuy; 0x67uy; 0xfauy; 0x83uy; 0xe1uy; 0x58uy; 0xc9uy; 0x94uy; 0xd9uy; 0x61uy; 0xc4uy; 0xcbuy; 0x21uy; 0x09uy; 0x5cuy; 0x1buy; 0xf9uy; 0xafuy; 0x48uy; 0x44uy; 0x3duy; 0x0buy; 0xb0uy; 0xd2uy; 0x11uy; 0x09uy; 0xc8uy; 0x9auy; 0x10uy; 0x0buy; 0x5cuy; 0xe2uy; 0xc2uy; 0x08uy; 0x83uy; 0x14uy; 0x9cuy; 0x69uy; 0xb5uy; 0x61uy; 0xdduy; 0x88uy; 0x29uy; 0x8auy; 0x17uy; 0x98uy; 0xb1uy; 0x07uy; 0x16uy; 0xefuy; 0x66uy; 0x3cuy; 0xeauy; 0x19uy; 0x0fuy; 0xfbuy; 0x83uy; 0xd8uy; 0x95uy; 0x93uy; 0xf3uy; 0xf4uy; 0x76uy; 0xb6uy; 0xbcuy; 0x24uy; ] in
assert_norm (List.Tot.length l = 112);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input8_len: (x:UInt32.t { UInt32.v x = B.length input8 }) =
112ul
let key8: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x12uy; 0x97uy; 0x6auy; 0x08uy; 0xc4uy; 0x42uy; 0x6duy; 0x0cuy; 0xe8uy; 0xa8uy; 0x24uy; 0x07uy; 0xc4uy; 0xf4uy; 0x82uy; 0x07uy; 0x80uy; 0xf8uy; 0xc2uy; 0x0auy; 0xa7uy; 0x12uy; 0x02uy; 0xd1uy; 0xe2uy; 0x91uy; 0x79uy; 0xcbuy; 0xcbuy; 0x55uy; 0x5auy; 0x57uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key8_len: (x:UInt32.t { UInt32.v x = B.length key8 }) =
32ul
let tag8: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0xc7uy; 0x94uy; 0xd7uy; 0x05uy; 0x7duy; 0x17uy; 0x78uy; 0xc4uy; 0xbbuy; 0xeeuy; 0x0auy; 0x39uy; 0xb3uy; 0xd9uy; 0x73uy; 0x42uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag8_len: (x:UInt32.t { UInt32.v x = B.length tag8 }) =
16ul
let input9: (b: B.buffer UInt8.t { B.length b = 128 /\ B.recallable b }) =
[@inline_let] let l = [ 0xabuy; 0x08uy; 0x12uy; 0x72uy; 0x4auy; 0x7fuy; 0x1euy; 0x34uy; 0x27uy; 0x42uy; 0xcbuy; 0xeduy; 0x37uy; 0x4duy; 0x94uy; 0xd1uy; 0x36uy; 0xc6uy; 0xb8uy; 0x79uy; 0x5duy; 0x45uy; 0xb3uy; 0x81uy; 0x98uy; 0x30uy; 0xf2uy; 0xc0uy; 0x44uy; 0x91uy; 0xfauy; 0xf0uy; 0x99uy; 0x0cuy; 0x62uy; 0xe4uy; 0x8buy; 0x80uy; 0x18uy; 0xb2uy; 0xc3uy; 0xe4uy; 0xa0uy; 0xfauy; 0x31uy; 0x34uy; 0xcbuy; 0x67uy; 0xfauy; 0x83uy; 0xe1uy; 0x58uy; 0xc9uy; 0x94uy; 0xd9uy; 0x61uy; 0xc4uy; 0xcbuy; 0x21uy; 0x09uy; 0x5cuy; 0x1buy; 0xf9uy; 0xafuy; 0x48uy; 0x44uy; 0x3duy; 0x0buy; 0xb0uy; 0xd2uy; 0x11uy; 0x09uy; 0xc8uy; 0x9auy; 0x10uy; 0x0buy; 0x5cuy; 0xe2uy; 0xc2uy; 0x08uy; 0x83uy; 0x14uy; 0x9cuy; 0x69uy; 0xb5uy; 0x61uy; 0xdduy; 0x88uy; 0x29uy; 0x8auy; 0x17uy; 0x98uy; 0xb1uy; 0x07uy; 0x16uy; 0xefuy; 0x66uy; 0x3cuy; 0xeauy; 0x19uy; 0x0fuy; 0xfbuy; 0x83uy; 0xd8uy; 0x95uy; 0x93uy; 0xf3uy; 0xf4uy; 0x76uy; 0xb6uy; 0xbcuy; 0x24uy; 0xd7uy; 0xe6uy; 0x79uy; 0x10uy; 0x7euy; 0xa2uy; 0x6auy; 0xdbuy; 0x8cuy; 0xafuy; 0x66uy; 0x52uy; 0xd0uy; 0x65uy; 0x61uy; 0x36uy; ] in
assert_norm (List.Tot.length l = 128);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input9_len: (x:UInt32.t { UInt32.v x = B.length input9 }) =
128ul
let key9: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x12uy; 0x97uy; 0x6auy; 0x08uy; 0xc4uy; 0x42uy; 0x6duy; 0x0cuy; 0xe8uy; 0xa8uy; 0x24uy; 0x07uy; 0xc4uy; 0xf4uy; 0x82uy; 0x07uy; 0x80uy; 0xf8uy; 0xc2uy; 0x0auy; 0xa7uy; 0x12uy; 0x02uy; 0xd1uy; 0xe2uy; 0x91uy; 0x79uy; 0xcbuy; 0xcbuy; 0x55uy; 0x5auy; 0x57uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key9_len: (x:UInt32.t { UInt32.v x = B.length key9 }) =
32ul
let tag9: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0xffuy; 0xbcuy; 0xb9uy; 0xb3uy; 0x71uy; 0x42uy; 0x31uy; 0x52uy; 0xd7uy; 0xfcuy; 0xa5uy; 0xaduy; 0x04uy; 0x2fuy; 0xbauy; 0xa9uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag9_len: (x:UInt32.t { UInt32.v x = B.length tag9 }) =
16ul
let input10: (b: B.buffer UInt8.t { B.length b = 144 /\ B.recallable b }) =
[@inline_let] let l = [ 0xabuy; 0x08uy; 0x12uy; 0x72uy; 0x4auy; 0x7fuy; 0x1euy; 0x34uy; 0x27uy; 0x42uy; 0xcbuy; 0xeduy; 0x37uy; 0x4duy; 0x94uy; 0xd1uy; 0x36uy; 0xc6uy; 0xb8uy; 0x79uy; 0x5duy; 0x45uy; 0xb3uy; 0x81uy; 0x98uy; 0x30uy; 0xf2uy; 0xc0uy; 0x44uy; 0x91uy; 0xfauy; 0xf0uy; 0x99uy; 0x0cuy; 0x62uy; 0xe4uy; 0x8buy; 0x80uy; 0x18uy; 0xb2uy; 0xc3uy; 0xe4uy; 0xa0uy; 0xfauy; 0x31uy; 0x34uy; 0xcbuy; 0x67uy; 0xfauy; 0x83uy; 0xe1uy; 0x58uy; 0xc9uy; 0x94uy; 0xd9uy; 0x61uy; 0xc4uy; 0xcbuy; 0x21uy; 0x09uy; 0x5cuy; 0x1buy; 0xf9uy; 0xafuy; 0x48uy; 0x44uy; 0x3duy; 0x0buy; 0xb0uy; 0xd2uy; 0x11uy; 0x09uy; 0xc8uy; 0x9auy; 0x10uy; 0x0buy; 0x5cuy; 0xe2uy; 0xc2uy; 0x08uy; 0x83uy; 0x14uy; 0x9cuy; 0x69uy; 0xb5uy; 0x61uy; 0xdduy; 0x88uy; 0x29uy; 0x8auy; 0x17uy; 0x98uy; 0xb1uy; 0x07uy; 0x16uy; 0xefuy; 0x66uy; 0x3cuy; 0xeauy; 0x19uy; 0x0fuy; 0xfbuy; 0x83uy; 0xd8uy; 0x95uy; 0x93uy; 0xf3uy; 0xf4uy; 0x76uy; 0xb6uy; 0xbcuy; 0x24uy; 0xd7uy; 0xe6uy; 0x79uy; 0x10uy; 0x7euy; 0xa2uy; 0x6auy; 0xdbuy; 0x8cuy; 0xafuy; 0x66uy; 0x52uy; 0xd0uy; 0x65uy; 0x61uy; 0x36uy; 0x81uy; 0x20uy; 0x59uy; 0xa5uy; 0xdauy; 0x19uy; 0x86uy; 0x37uy; 0xcauy; 0xc7uy; 0xc4uy; 0xa6uy; 0x31uy; 0xbeuy; 0xe4uy; 0x66uy; ] in
assert_norm (List.Tot.length l = 144);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input10_len: (x:UInt32.t { UInt32.v x = B.length input10 }) =
144ul
let key10: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x12uy; 0x97uy; 0x6auy; 0x08uy; 0xc4uy; 0x42uy; 0x6duy; 0x0cuy; 0xe8uy; 0xa8uy; 0x24uy; 0x07uy; 0xc4uy; 0xf4uy; 0x82uy; 0x07uy; 0x80uy; 0xf8uy; 0xc2uy; 0x0auy; 0xa7uy; 0x12uy; 0x02uy; 0xd1uy; 0xe2uy; 0x91uy; 0x79uy; 0xcbuy; 0xcbuy; 0x55uy; 0x5auy; 0x57uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key10_len: (x:UInt32.t { UInt32.v x = B.length key10 }) =
32ul
let tag10: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0x06uy; 0x9euy; 0xd6uy; 0xb8uy; 0xefuy; 0x0fuy; 0x20uy; 0x7buy; 0x3euy; 0x24uy; 0x3buy; 0xb1uy; 0x01uy; 0x9fuy; 0xe6uy; 0x32uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag10_len: (x:UInt32.t { UInt32.v x = B.length tag10 }) =
16ul
let input11: (b: B.buffer UInt8.t { B.length b = 160 /\ B.recallable b }) =
[@inline_let] let l = [ 0xabuy; 0x08uy; 0x12uy; 0x72uy; 0x4auy; 0x7fuy; 0x1euy; 0x34uy; 0x27uy; 0x42uy; 0xcbuy; 0xeduy; 0x37uy; 0x4duy; 0x94uy; 0xd1uy; 0x36uy; 0xc6uy; 0xb8uy; 0x79uy; 0x5duy; 0x45uy; 0xb3uy; 0x81uy; 0x98uy; 0x30uy; 0xf2uy; 0xc0uy; 0x44uy; 0x91uy; 0xfauy; 0xf0uy; 0x99uy; 0x0cuy; 0x62uy; 0xe4uy; 0x8buy; 0x80uy; 0x18uy; 0xb2uy; 0xc3uy; 0xe4uy; 0xa0uy; 0xfauy; 0x31uy; 0x34uy; 0xcbuy; 0x67uy; 0xfauy; 0x83uy; 0xe1uy; 0x58uy; 0xc9uy; 0x94uy; 0xd9uy; 0x61uy; 0xc4uy; 0xcbuy; 0x21uy; 0x09uy; 0x5cuy; 0x1buy; 0xf9uy; 0xafuy; 0x48uy; 0x44uy; 0x3duy; 0x0buy; 0xb0uy; 0xd2uy; 0x11uy; 0x09uy; 0xc8uy; 0x9auy; 0x10uy; 0x0buy; 0x5cuy; 0xe2uy; 0xc2uy; 0x08uy; 0x83uy; 0x14uy; 0x9cuy; 0x69uy; 0xb5uy; 0x61uy; 0xdduy; 0x88uy; 0x29uy; 0x8auy; 0x17uy; 0x98uy; 0xb1uy; 0x07uy; 0x16uy; 0xefuy; 0x66uy; 0x3cuy; 0xeauy; 0x19uy; 0x0fuy; 0xfbuy; 0x83uy; 0xd8uy; 0x95uy; 0x93uy; 0xf3uy; 0xf4uy; 0x76uy; 0xb6uy; 0xbcuy; 0x24uy; 0xd7uy; 0xe6uy; 0x79uy; 0x10uy; 0x7euy; 0xa2uy; 0x6auy; 0xdbuy; 0x8cuy; 0xafuy; 0x66uy; 0x52uy; 0xd0uy; 0x65uy; 0x61uy; 0x36uy; 0x81uy; 0x20uy; 0x59uy; 0xa5uy; 0xdauy; 0x19uy; 0x86uy; 0x37uy; 0xcauy; 0xc7uy; 0xc4uy; 0xa6uy; 0x31uy; 0xbeuy; 0xe4uy; 0x66uy; 0x5buy; 0x88uy; 0xd7uy; 0xf6uy; 0x22uy; 0x8buy; 0x11uy; 0xe2uy; 0xe2uy; 0x85uy; 0x79uy; 0xa5uy; 0xc0uy; 0xc1uy; 0xf7uy; 0x61uy; ] in
assert_norm (List.Tot.length l = 160);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input11_len: (x:UInt32.t { UInt32.v x = B.length input11 }) =
160ul
let key11: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x12uy; 0x97uy; 0x6auy; 0x08uy; 0xc4uy; 0x42uy; 0x6duy; 0x0cuy; 0xe8uy; 0xa8uy; 0x24uy; 0x07uy; 0xc4uy; 0xf4uy; 0x82uy; 0x07uy; 0x80uy; 0xf8uy; 0xc2uy; 0x0auy; 0xa7uy; 0x12uy; 0x02uy; 0xd1uy; 0xe2uy; 0x91uy; 0x79uy; 0xcbuy; 0xcbuy; 0x55uy; 0x5auy; 0x57uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key11_len: (x:UInt32.t { UInt32.v x = B.length key11 }) =
32ul
let tag11: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0xccuy; 0xa3uy; 0x39uy; 0xd9uy; 0xa4uy; 0x5fuy; 0xa2uy; 0x36uy; 0x8cuy; 0x2cuy; 0x68uy; 0xb3uy; 0xa4uy; 0x17uy; 0x91uy; 0x33uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag11_len: (x:UInt32.t { UInt32.v x = B.length tag11 }) =
16ul
let input12: (b: B.buffer UInt8.t { B.length b = 288 /\ B.recallable b }) =
[@inline_let] let l = [ 0xabuy; 0x08uy; 0x12uy; 0x72uy; 0x4auy; 0x7fuy; 0x1euy; 0x34uy; 0x27uy; 0x42uy; 0xcbuy; 0xeduy; 0x37uy; 0x4duy; 0x94uy; 0xd1uy; 0x36uy; 0xc6uy; 0xb8uy; 0x79uy; 0x5duy; 0x45uy; 0xb3uy; 0x81uy; 0x98uy; 0x30uy; 0xf2uy; 0xc0uy; 0x44uy; 0x91uy; 0xfauy; 0xf0uy; 0x99uy; 0x0cuy; 0x62uy; 0xe4uy; 0x8buy; 0x80uy; 0x18uy; 0xb2uy; 0xc3uy; 0xe4uy; 0xa0uy; 0xfauy; 0x31uy; 0x34uy; 0xcbuy; 0x67uy; 0xfauy; 0x83uy; 0xe1uy; 0x58uy; 0xc9uy; 0x94uy; 0xd9uy; 0x61uy; 0xc4uy; 0xcbuy; 0x21uy; 0x09uy; 0x5cuy; 0x1buy; 0xf9uy; 0xafuy; 0x48uy; 0x44uy; 0x3duy; 0x0buy; 0xb0uy; 0xd2uy; 0x11uy; 0x09uy; 0xc8uy; 0x9auy; 0x10uy; 0x0buy; 0x5cuy; 0xe2uy; 0xc2uy; 0x08uy; 0x83uy; 0x14uy; 0x9cuy; 0x69uy; 0xb5uy; 0x61uy; 0xdduy; 0x88uy; 0x29uy; 0x8auy; 0x17uy; 0x98uy; 0xb1uy; 0x07uy; 0x16uy; 0xefuy; 0x66uy; 0x3cuy; 0xeauy; 0x19uy; 0x0fuy; 0xfbuy; 0x83uy; 0xd8uy; 0x95uy; 0x93uy; 0xf3uy; 0xf4uy; 0x76uy; 0xb6uy; 0xbcuy; 0x24uy; 0xd7uy; 0xe6uy; 0x79uy; 0x10uy; 0x7euy; 0xa2uy; 0x6auy; 0xdbuy; 0x8cuy; 0xafuy; 0x66uy; 0x52uy; 0xd0uy; 0x65uy; 0x61uy; 0x36uy; 0x81uy; 0x20uy; 0x59uy; 0xa5uy; 0xdauy; 0x19uy; 0x86uy; 0x37uy; 0xcauy; 0xc7uy; 0xc4uy; 0xa6uy; 0x31uy; 0xbeuy; 0xe4uy; 0x66uy; 0x5buy; 0x88uy; 0xd7uy; 0xf6uy; 0x22uy; 0x8buy; 0x11uy; 0xe2uy; 0xe2uy; 0x85uy; 0x79uy; 0xa5uy; 0xc0uy; 0xc1uy; 0xf7uy; 0x61uy; 0xabuy; 0x08uy; 0x12uy; 0x72uy; 0x4auy; 0x7fuy; 0x1euy; 0x34uy; 0x27uy; 0x42uy; 0xcbuy; 0xeduy; 0x37uy; 0x4duy; 0x94uy; 0xd1uy; 0x36uy; 0xc6uy; 0xb8uy; 0x79uy; 0x5duy; 0x45uy; 0xb3uy; 0x81uy; 0x98uy; 0x30uy; 0xf2uy; 0xc0uy; 0x44uy; 0x91uy; 0xfauy; 0xf0uy; 0x99uy; 0x0cuy; 0x62uy; 0xe4uy; 0x8buy; 0x80uy; 0x18uy; 0xb2uy; 0xc3uy; 0xe4uy; 0xa0uy; 0xfauy; 0x31uy; 0x34uy; 0xcbuy; 0x67uy; 0xfauy; 0x83uy; 0xe1uy; 0x58uy; 0xc9uy; 0x94uy; 0xd9uy; 0x61uy; 0xc4uy; 0xcbuy; 0x21uy; 0x09uy; 0x5cuy; 0x1buy; 0xf9uy; 0xafuy; 0x48uy; 0x44uy; 0x3duy; 0x0buy; 0xb0uy; 0xd2uy; 0x11uy; 0x09uy; 0xc8uy; 0x9auy; 0x10uy; 0x0buy; 0x5cuy; 0xe2uy; 0xc2uy; 0x08uy; 0x83uy; 0x14uy; 0x9cuy; 0x69uy; 0xb5uy; 0x61uy; 0xdduy; 0x88uy; 0x29uy; 0x8auy; 0x17uy; 0x98uy; 0xb1uy; 0x07uy; 0x16uy; 0xefuy; 0x66uy; 0x3cuy; 0xeauy; 0x19uy; 0x0fuy; 0xfbuy; 0x83uy; 0xd8uy; 0x95uy; 0x93uy; 0xf3uy; 0xf4uy; 0x76uy; 0xb6uy; 0xbcuy; 0x24uy; 0xd7uy; 0xe6uy; 0x79uy; 0x10uy; 0x7euy; 0xa2uy; 0x6auy; 0xdbuy; 0x8cuy; 0xafuy; 0x66uy; 0x52uy; 0xd0uy; 0x65uy; 0x61uy; 0x36uy; ] in
assert_norm (List.Tot.length l = 288);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input12_len: (x:UInt32.t { UInt32.v x = B.length input12 }) =
288ul
let key12: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x12uy; 0x97uy; 0x6auy; 0x08uy; 0xc4uy; 0x42uy; 0x6duy; 0x0cuy; 0xe8uy; 0xa8uy; 0x24uy; 0x07uy; 0xc4uy; 0xf4uy; 0x82uy; 0x07uy; 0x80uy; 0xf8uy; 0xc2uy; 0x0auy; 0xa7uy; 0x12uy; 0x02uy; 0xd1uy; 0xe2uy; 0x91uy; 0x79uy; 0xcbuy; 0xcbuy; 0x55uy; 0x5auy; 0x57uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key12_len: (x:UInt32.t { UInt32.v x = B.length key12 }) =
32ul
let tag12: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0x53uy; 0xf6uy; 0xe8uy; 0x28uy; 0xa2uy; 0xf0uy; 0xfeuy; 0x0euy; 0xe8uy; 0x15uy; 0xbfuy; 0x0buy; 0xd5uy; 0x84uy; 0x1auy; 0x34uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag12_len: (x:UInt32.t { UInt32.v x = B.length tag12 }) =
16ul
let input13: (b: B.buffer UInt8.t { B.length b = 320 /\ B.recallable b }) =
[@inline_let] let l = [ 0xabuy; 0x08uy; 0x12uy; 0x72uy; 0x4auy; 0x7fuy; 0x1euy; 0x34uy; 0x27uy; 0x42uy; 0xcbuy; 0xeduy; 0x37uy; 0x4duy; 0x94uy; 0xd1uy; 0x36uy; 0xc6uy; 0xb8uy; 0x79uy; 0x5duy; 0x45uy; 0xb3uy; 0x81uy; 0x98uy; 0x30uy; 0xf2uy; 0xc0uy; 0x44uy; 0x91uy; 0xfauy; 0xf0uy; 0x99uy; 0x0cuy; 0x62uy; 0xe4uy; 0x8buy; 0x80uy; 0x18uy; 0xb2uy; 0xc3uy; 0xe4uy; 0xa0uy; 0xfauy; 0x31uy; 0x34uy; 0xcbuy; 0x67uy; 0xfauy; 0x83uy; 0xe1uy; 0x58uy; 0xc9uy; 0x94uy; 0xd9uy; 0x61uy; 0xc4uy; 0xcbuy; 0x21uy; 0x09uy; 0x5cuy; 0x1buy; 0xf9uy; 0xafuy; 0x48uy; 0x44uy; 0x3duy; 0x0buy; 0xb0uy; 0xd2uy; 0x11uy; 0x09uy; 0xc8uy; 0x9auy; 0x10uy; 0x0buy; 0x5cuy; 0xe2uy; 0xc2uy; 0x08uy; 0x83uy; 0x14uy; 0x9cuy; 0x69uy; 0xb5uy; 0x61uy; 0xdduy; 0x88uy; 0x29uy; 0x8auy; 0x17uy; 0x98uy; 0xb1uy; 0x07uy; 0x16uy; 0xefuy; 0x66uy; 0x3cuy; 0xeauy; 0x19uy; 0x0fuy; 0xfbuy; 0x83uy; 0xd8uy; 0x95uy; 0x93uy; 0xf3uy; 0xf4uy; 0x76uy; 0xb6uy; 0xbcuy; 0x24uy; 0xd7uy; 0xe6uy; 0x79uy; 0x10uy; 0x7euy; 0xa2uy; 0x6auy; 0xdbuy; 0x8cuy; 0xafuy; 0x66uy; 0x52uy; 0xd0uy; 0x65uy; 0x61uy; 0x36uy; 0x81uy; 0x20uy; 0x59uy; 0xa5uy; 0xdauy; 0x19uy; 0x86uy; 0x37uy; 0xcauy; 0xc7uy; 0xc4uy; 0xa6uy; 0x31uy; 0xbeuy; 0xe4uy; 0x66uy; 0x5buy; 0x88uy; 0xd7uy; 0xf6uy; 0x22uy; 0x8buy; 0x11uy; 0xe2uy; 0xe2uy; 0x85uy; 0x79uy; 0xa5uy; 0xc0uy; 0xc1uy; 0xf7uy; 0x61uy; 0xabuy; 0x08uy; 0x12uy; 0x72uy; 0x4auy; 0x7fuy; 0x1euy; 0x34uy; 0x27uy; 0x42uy; 0xcbuy; 0xeduy; 0x37uy; 0x4duy; 0x94uy; 0xd1uy; 0x36uy; 0xc6uy; 0xb8uy; 0x79uy; 0x5duy; 0x45uy; 0xb3uy; 0x81uy; 0x98uy; 0x30uy; 0xf2uy; 0xc0uy; 0x44uy; 0x91uy; 0xfauy; 0xf0uy; 0x99uy; 0x0cuy; 0x62uy; 0xe4uy; 0x8buy; 0x80uy; 0x18uy; 0xb2uy; 0xc3uy; 0xe4uy; 0xa0uy; 0xfauy; 0x31uy; 0x34uy; 0xcbuy; 0x67uy; 0xfauy; 0x83uy; 0xe1uy; 0x58uy; 0xc9uy; 0x94uy; 0xd9uy; 0x61uy; 0xc4uy; 0xcbuy; 0x21uy; 0x09uy; 0x5cuy; 0x1buy; 0xf9uy; 0xafuy; 0x48uy; 0x44uy; 0x3duy; 0x0buy; 0xb0uy; 0xd2uy; 0x11uy; 0x09uy; 0xc8uy; 0x9auy; 0x10uy; 0x0buy; 0x5cuy; 0xe2uy; 0xc2uy; 0x08uy; 0x83uy; 0x14uy; 0x9cuy; 0x69uy; 0xb5uy; 0x61uy; 0xdduy; 0x88uy; 0x29uy; 0x8auy; 0x17uy; 0x98uy; 0xb1uy; 0x07uy; 0x16uy; 0xefuy; 0x66uy; 0x3cuy; 0xeauy; 0x19uy; 0x0fuy; 0xfbuy; 0x83uy; 0xd8uy; 0x95uy; 0x93uy; 0xf3uy; 0xf4uy; 0x76uy; 0xb6uy; 0xbcuy; 0x24uy; 0xd7uy; 0xe6uy; 0x79uy; 0x10uy; 0x7euy; 0xa2uy; 0x6auy; 0xdbuy; 0x8cuy; 0xafuy; 0x66uy; 0x52uy; 0xd0uy; 0x65uy; 0x61uy; 0x36uy; 0x81uy; 0x20uy; 0x59uy; 0xa5uy; 0xdauy; 0x19uy; 0x86uy; 0x37uy; 0xcauy; 0xc7uy; 0xc4uy; 0xa6uy; 0x31uy; 0xbeuy; 0xe4uy; 0x66uy; 0x5buy; 0x88uy; 0xd7uy; 0xf6uy; 0x22uy; 0x8buy; 0x11uy; 0xe2uy; 0xe2uy; 0x85uy; 0x79uy; 0xa5uy; 0xc0uy; 0xc1uy; 0xf7uy; 0x61uy; ] in
assert_norm (List.Tot.length l = 320);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input13_len: (x:UInt32.t { UInt32.v x = B.length input13 }) =
320ul
let key13: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x12uy; 0x97uy; 0x6auy; 0x08uy; 0xc4uy; 0x42uy; 0x6duy; 0x0cuy; 0xe8uy; 0xa8uy; 0x24uy; 0x07uy; 0xc4uy; 0xf4uy; 0x82uy; 0x07uy; 0x80uy; 0xf8uy; 0xc2uy; 0x0auy; 0xa7uy; 0x12uy; 0x02uy; 0xd1uy; 0xe2uy; 0x91uy; 0x79uy; 0xcbuy; 0xcbuy; 0x55uy; 0x5auy; 0x57uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key13_len: (x:UInt32.t { UInt32.v x = B.length key13 }) =
32ul
let tag13: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0xb8uy; 0x46uy; 0xd4uy; 0x4euy; 0x9buy; 0xbduy; 0x53uy; 0xceuy; 0xdfuy; 0xfbuy; 0xfbuy; 0xb6uy; 0xb7uy; 0xfauy; 0x49uy; 0x33uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag13_len: (x:UInt32.t { UInt32.v x = B.length tag13 }) =
16ul
let input14: (b: B.buffer UInt8.t { B.length b = 256 /\ B.recallable b }) =
[@inline_let] let l = [ 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; 0xffuy; ] in
assert_norm (List.Tot.length l = 256);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input14_len: (x:UInt32.t { UInt32.v x = B.length input14 }) =
256ul
let key14: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0xaduy; 0x62uy; 0x81uy; 0x07uy; 0xe8uy; 0x35uy; 0x1duy; 0x0fuy; 0x2cuy; 0x23uy; 0x1auy; 0x05uy; 0xdcuy; 0x4auy; 0x41uy; 0x06uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key14_len: (x:UInt32.t { UInt32.v x = B.length key14 }) =
32ul
let tag14: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0x07uy; 0x14uy; 0x5auy; 0x4cuy; 0x02uy; 0xfeuy; 0x5fuy; 0xa3uy; 0x20uy; 0x36uy; 0xdeuy; 0x68uy; 0xfauy; 0xbeuy; 0x90uy; 0x66uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag14_len: (x:UInt32.t { UInt32.v x = B.length tag14 }) =
16ul
let input15: (b: B.buffer UInt8.t { B.length b = 252 /\ B.recallable b }) =
[@inline_let] let l = [ 0x84uy; 0x23uy; 0x64uy; 0xe1uy; 0x56uy; 0x33uy; 0x6cuy; 0x09uy; 0x98uy; 0xb9uy; 0x33uy; 0xa6uy; 0x23uy; 0x77uy; 0x26uy; 0x18uy; 0x0duy; 0x9euy; 0x3fuy; 0xdcuy; 0xbduy; 0xe4uy; 0xcduy; 0x5duy; 0x17uy; 0x08uy; 0x0fuy; 0xc3uy; 0xbeuy; 0xb4uy; 0x96uy; 0x14uy; 0xd7uy; 0x12uy; 0x2cuy; 0x03uy; 0x74uy; 0x63uy; 0xffuy; 0x10uy; 0x4duy; 0x73uy; 0xf1uy; 0x9cuy; 0x12uy; 0x70uy; 0x46uy; 0x28uy; 0xd4uy; 0x17uy; 0xc4uy; 0xc5uy; 0x4auy; 0x3fuy; 0xe3uy; 0x0duy; 0x3cuy; 0x3duy; 0x77uy; 0x14uy; 0x38uy; 0x2duy; 0x43uy; 0xb0uy; 0x38uy; 0x2auy; 0x50uy; 0xa5uy; 0xdeuy; 0xe5uy; 0x4buy; 0xe8uy; 0x44uy; 0xb0uy; 0x76uy; 0xe8uy; 0xdfuy; 0x88uy; 0x20uy; 0x1auy; 0x1cuy; 0xd4uy; 0x3buy; 0x90uy; 0xebuy; 0x21uy; 0x64uy; 0x3fuy; 0xa9uy; 0x6fuy; 0x39uy; 0xb5uy; 0x18uy; 0xaauy; 0x83uy; 0x40uy; 0xc9uy; 0x42uy; 0xffuy; 0x3cuy; 0x31uy; 0xbauy; 0xf7uy; 0xc9uy; 0xbduy; 0xbfuy; 0x0fuy; 0x31uy; 0xaeuy; 0x3fuy; 0xa0uy; 0x96uy; 0xbfuy; 0x8cuy; 0x63uy; 0x03uy; 0x06uy; 0x09uy; 0x82uy; 0x9fuy; 0xe7uy; 0x2euy; 0x17uy; 0x98uy; 0x24uy; 0x89uy; 0x0buy; 0xc8uy; 0xe0uy; 0x8cuy; 0x31uy; 0x5cuy; 0x1cuy; 0xceuy; 0x2auy; 0x83uy; 0x14uy; 0x4duy; 0xbbuy; 0xffuy; 0x09uy; 0xf7uy; 0x4euy; 0x3euy; 0xfcuy; 0x77uy; 0x0buy; 0x54uy; 0xd0uy; 0x98uy; 0x4auy; 0x8fuy; 0x19uy; 0xb1uy; 0x47uy; 0x19uy; 0xe6uy; 0x36uy; 0x35uy; 0x64uy; 0x1duy; 0x6buy; 0x1euy; 0xeduy; 0xf6uy; 0x3euy; 0xfbuy; 0xf0uy; 0x80uy; 0xe1uy; 0x78uy; 0x3duy; 0x32uy; 0x44uy; 0x54uy; 0x12uy; 0x11uy; 0x4cuy; 0x20uy; 0xdeuy; 0x0buy; 0x83uy; 0x7auy; 0x0duy; 0xfauy; 0x33uy; 0xd6uy; 0xb8uy; 0x28uy; 0x25uy; 0xffuy; 0xf4uy; 0x4cuy; 0x9auy; 0x70uy; 0xeauy; 0x54uy; 0xceuy; 0x47uy; 0xf0uy; 0x7duy; 0xf6uy; 0x98uy; 0xe6uy; 0xb0uy; 0x33uy; 0x23uy; 0xb5uy; 0x30uy; 0x79uy; 0x36uy; 0x4auy; 0x5fuy; 0xc3uy; 0xe9uy; 0xdduy; 0x03uy; 0x43uy; 0x92uy; 0xbduy; 0xdeuy; 0x86uy; 0xdcuy; 0xcduy; 0xdauy; 0x94uy; 0x32uy; 0x1cuy; 0x5euy; 0x44uy; 0x06uy; 0x04uy; 0x89uy; 0x33uy; 0x6cuy; 0xb6uy; 0x5buy; 0xf3uy; 0x98uy; 0x9cuy; 0x36uy; 0xf7uy; 0x28uy; 0x2cuy; 0x2fuy; 0x5duy; 0x2buy; 0x88uy; 0x2cuy; 0x17uy; 0x1euy; 0x74uy; ] in
assert_norm (List.Tot.length l = 252);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input15_len: (x:UInt32.t { UInt32.v x = B.length input15 }) =
252ul
let key15: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x95uy; 0xd5uy; 0xc0uy; 0x05uy; 0x50uy; 0x3euy; 0x51uy; 0x0duy; 0x8cuy; 0xd0uy; 0xaauy; 0x07uy; 0x2cuy; 0x4auy; 0x4duy; 0x06uy; 0x6euy; 0xabuy; 0xc5uy; 0x2duy; 0x11uy; 0x65uy; 0x3duy; 0xf4uy; 0x7fuy; 0xbfuy; 0x63uy; 0xabuy; 0x19uy; 0x8buy; 0xccuy; 0x26uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key15_len: (x:UInt32.t { UInt32.v x = B.length key15 }) =
32ul
let tag15: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0xf2uy; 0x48uy; 0x31uy; 0x2euy; 0x57uy; 0x8duy; 0x9duy; 0x58uy; 0xf8uy; 0xb7uy; 0xbbuy; 0x4duy; 0x19uy; 0x10uy; 0x54uy; 0x31uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag15_len: (x:UInt32.t { UInt32.v x = B.length tag15 }) =
16ul
let input16: (b: B.buffer UInt8.t { B.length b = 208 /\ B.recallable b }) =
[@inline_let] let l = [ 0x24uy; 0x8auy; 0xc3uy; 0x10uy; 0x85uy; 0xb6uy; 0xc2uy; 0xaduy; 0xaauy; 0xa3uy; 0x82uy; 0x59uy; 0xa0uy; 0xd7uy; 0x19uy; 0x2cuy; 0x5cuy; 0x35uy; 0xd1uy; 0xbbuy; 0x4euy; 0xf3uy; 0x9auy; 0xd9uy; 0x4cuy; 0x38uy; 0xd1uy; 0xc8uy; 0x24uy; 0x79uy; 0xe2uy; 0xdduy; 0x21uy; 0x59uy; 0xa0uy; 0x77uy; 0x02uy; 0x4buy; 0x05uy; 0x89uy; 0xbcuy; 0x8auy; 0x20uy; 0x10uy; 0x1buy; 0x50uy; 0x6fuy; 0x0auy; 0x1auy; 0xd0uy; 0xbbuy; 0xabuy; 0x76uy; 0xe8uy; 0x3auy; 0x83uy; 0xf1uy; 0xb9uy; 0x4buy; 0xe6uy; 0xbeuy; 0xaeuy; 0x74uy; 0xe8uy; 0x74uy; 0xcauy; 0xb6uy; 0x92uy; 0xc5uy; 0x96uy; 0x3auy; 0x75uy; 0x43uy; 0x6buy; 0x77uy; 0x61uy; 0x21uy; 0xecuy; 0x9fuy; 0x62uy; 0x39uy; 0x9auy; 0x3euy; 0x66uy; 0xb2uy; 0xd2uy; 0x27uy; 0x07uy; 0xdauy; 0xe8uy; 0x19uy; 0x33uy; 0xb6uy; 0x27uy; 0x7fuy; 0x3cuy; 0x85uy; 0x16uy; 0xbcuy; 0xbeuy; 0x26uy; 0xdbuy; 0xbduy; 0x86uy; 0xf3uy; 0x73uy; 0x10uy; 0x3duy; 0x7cuy; 0xf4uy; 0xcauy; 0xd1uy; 0x88uy; 0x8cuy; 0x95uy; 0x21uy; 0x18uy; 0xfbuy; 0xfbuy; 0xd0uy; 0xd7uy; 0xb4uy; 0xbeuy; 0xdcuy; 0x4auy; 0xe4uy; 0x93uy; 0x6auy; 0xffuy; 0x91uy; 0x15uy; 0x7euy; 0x7auy; 0xa4uy; 0x7cuy; 0x54uy; 0x44uy; 0x2euy; 0xa7uy; 0x8duy; 0x6auy; 0xc2uy; 0x51uy; 0xd3uy; 0x24uy; 0xa0uy; 0xfbuy; 0xe4uy; 0x9duy; 0x89uy; 0xccuy; 0x35uy; 0x21uy; 0xb6uy; 0x6duy; 0x16uy; 0xe9uy; 0xc6uy; 0x6auy; 0x37uy; 0x09uy; 0x89uy; 0x4euy; 0x4euy; 0xb0uy; 0xa4uy; 0xeeuy; 0xdcuy; 0x4auy; 0xe1uy; 0x94uy; 0x68uy; 0xe6uy; 0x6buy; 0x81uy; 0xf2uy; 0x71uy; 0x35uy; 0x1buy; 0x1duy; 0x92uy; 0x1euy; 0xa5uy; 0x51uy; 0x04uy; 0x7auy; 0xbcuy; 0xc6uy; 0xb8uy; 0x7auy; 0x90uy; 0x1fuy; 0xdeuy; 0x7duy; 0xb7uy; 0x9fuy; 0xa1uy; 0x81uy; 0x8cuy; 0x11uy; 0x33uy; 0x6duy; 0xbcuy; 0x07uy; 0x24uy; 0x4auy; 0x40uy; 0xebuy; ] in
assert_norm (List.Tot.length l = 208);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input16_len: (x:UInt32.t { UInt32.v x = B.length input16 }) =
208ul
let key16: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy; 0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy; 0x0duy; 0x0euy; 0x0fuy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key16_len: (x:UInt32.t { UInt32.v x = B.length key16 }) =
32ul
let tag16: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0xbcuy; 0x93uy; 0x9buy; 0xc5uy; 0x28uy; 0x14uy; 0x80uy; 0xfauy; 0x99uy; 0xc6uy; 0xd6uy; 0x8cuy; 0x25uy; 0x8euy; 0xc4uy; 0x2fuy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag16_len: (x:UInt32.t { UInt32.v x = B.length tag16 }) =
16ul
let input17: (b: B.buffer UInt8.t { B.length b = 0 /\ B.recallable b }) =
[@inline_let] let l = [ ] in
assert_norm (List.Tot.length l = 0);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input17_len: (x:UInt32.t { UInt32.v x = B.length input17 }) =
0ul
let key17: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0xc8uy; 0xafuy; 0xaauy; 0xc3uy; 0x31uy; 0xeeuy; 0x37uy; 0x2cuy; 0xd6uy; 0x08uy; 0x2duy; 0xe1uy; 0x34uy; 0x94uy; 0x3buy; 0x17uy; 0x47uy; 0x10uy; 0x13uy; 0x0euy; 0x9fuy; 0x6fuy; 0xeauy; 0x8duy; 0x72uy; 0x29uy; 0x38uy; 0x50uy; 0xa6uy; 0x67uy; 0xd8uy; 0x6cuy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key17_len: (x:UInt32.t { UInt32.v x = B.length key17 }) =
32ul
let tag17: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0x47uy; 0x10uy; 0x13uy; 0x0euy; 0x9fuy; 0x6fuy; 0xeauy; 0x8duy; 0x72uy; 0x29uy; 0x38uy; 0x50uy; 0xa6uy; 0x67uy; 0xd8uy; 0x6cuy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag17_len: (x:UInt32.t { UInt32.v x = B.length tag17 }) =
16ul
let input18: (b: B.buffer UInt8.t { B.length b = 12 /\ B.recallable b }) =
[@inline_let] let l = [ 0x48uy; 0x65uy; 0x6cuy; 0x6cuy; 0x6fuy; 0x20uy; 0x77uy; 0x6fuy; 0x72uy; 0x6cuy; 0x64uy; 0x21uy; ] in
assert_norm (List.Tot.length l = 12);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input18_len: (x:UInt32.t { UInt32.v x = B.length input18 }) =
12ul
let key18: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x74uy; 0x68uy; 0x69uy; 0x73uy; 0x20uy; 0x69uy; 0x73uy; 0x20uy; 0x33uy; 0x32uy; 0x2duy; 0x62uy; 0x79uy; 0x74uy; 0x65uy; 0x20uy; 0x6buy; 0x65uy; 0x79uy; 0x20uy; 0x66uy; 0x6fuy; 0x72uy; 0x20uy; 0x50uy; 0x6fuy; 0x6cuy; 0x79uy; 0x31uy; 0x33uy; 0x30uy; 0x35uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key18_len: (x:UInt32.t { UInt32.v x = B.length key18 }) =
32ul
let tag18: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0xa6uy; 0xf7uy; 0x45uy; 0x00uy; 0x8fuy; 0x81uy; 0xc9uy; 0x16uy; 0xa2uy; 0x0duy; 0xccuy; 0x74uy; 0xeeuy; 0xf2uy; 0xb2uy; 0xf0uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag18_len: (x:UInt32.t { UInt32.v x = B.length tag18 }) =
16ul
let input19: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input19_len: (x:UInt32.t { UInt32.v x = B.length input19 }) =
32ul
let key19: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x74uy; 0x68uy; 0x69uy; 0x73uy; 0x20uy; 0x69uy; 0x73uy; 0x20uy; 0x33uy; 0x32uy; 0x2duy; 0x62uy; 0x79uy; 0x74uy; 0x65uy; 0x20uy; 0x6buy; 0x65uy; 0x79uy; 0x20uy; 0x66uy; 0x6fuy; 0x72uy; 0x20uy; 0x50uy; 0x6fuy; 0x6cuy; 0x79uy; 0x31uy; 0x33uy; 0x30uy; 0x35uy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key19_len: (x:UInt32.t { UInt32.v x = B.length key19 }) =
32ul
let tag19: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0x49uy; 0xecuy; 0x78uy; 0x09uy; 0x0euy; 0x48uy; 0x1euy; 0xc6uy; 0xc2uy; 0x6buy; 0x33uy; 0xb9uy; 0x1cuy; 0xccuy; 0x03uy; 0x07uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag19_len: (x:UInt32.t { UInt32.v x = B.length tag19 }) =
16ul
let input20: (b: B.buffer UInt8.t { B.length b = 128 /\ B.recallable b }) =
[@inline_let] let l = [ 0x89uy; 0xdauy; 0xb8uy; 0x0buy; 0x77uy; 0x17uy; 0xc1uy; 0xdbuy; 0x5duy; 0xb4uy; 0x37uy; 0x86uy; 0x0auy; 0x3fuy; 0x70uy; 0x21uy; 0x8euy; 0x93uy; 0xe1uy; 0xb8uy; 0xf4uy; 0x61uy; 0xfbuy; 0x67uy; 0x7fuy; 0x16uy; 0xf3uy; 0x5fuy; 0x6fuy; 0x87uy; 0xe2uy; 0xa9uy; 0x1cuy; 0x99uy; 0xbcuy; 0x3auy; 0x47uy; 0xacuy; 0xe4uy; 0x76uy; 0x40uy; 0xccuy; 0x95uy; 0xc3uy; 0x45uy; 0xbeuy; 0x5euy; 0xccuy; 0xa5uy; 0xa3uy; 0x52uy; 0x3cuy; 0x35uy; 0xccuy; 0x01uy; 0x89uy; 0x3auy; 0xf0uy; 0xb6uy; 0x4auy; 0x62uy; 0x03uy; 0x34uy; 0x27uy; 0x03uy; 0x72uy; 0xecuy; 0x12uy; 0x48uy; 0x2duy; 0x1buy; 0x1euy; 0x36uy; 0x35uy; 0x61uy; 0x69uy; 0x8auy; 0x57uy; 0x8buy; 0x35uy; 0x98uy; 0x03uy; 0x49uy; 0x5buy; 0xb4uy; 0xe2uy; 0xefuy; 0x19uy; 0x30uy; 0xb1uy; 0x7auy; 0x51uy; 0x90uy; 0xb5uy; 0x80uy; 0xf1uy; 0x41uy; 0x30uy; 0x0duy; 0xf3uy; 0x0auy; 0xdbuy; 0xecuy; 0xa2uy; 0x8fuy; 0x64uy; 0x27uy; 0xa8uy; 0xbcuy; 0x1auy; 0x99uy; 0x9fuy; 0xd5uy; 0x1cuy; 0x55uy; 0x4auy; 0x01uy; 0x7duy; 0x09uy; 0x5duy; 0x8cuy; 0x3euy; 0x31uy; 0x27uy; 0xdauy; 0xf9uy; 0xf5uy; 0x95uy; ] in
assert_norm (List.Tot.length l = 128);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let input20_len: (x:UInt32.t { UInt32.v x = B.length input20 }) =
128ul
let key20: (b: B.buffer UInt8.t { B.length b = 32 /\ B.recallable b }) =
[@inline_let] let l = [ 0x2duy; 0x77uy; 0x3buy; 0xe3uy; 0x7auy; 0xdbuy; 0x1euy; 0x4duy; 0x68uy; 0x3buy; 0xf0uy; 0x07uy; 0x5euy; 0x79uy; 0xc4uy; 0xeeuy; 0x03uy; 0x79uy; 0x18uy; 0x53uy; 0x5auy; 0x7fuy; 0x99uy; 0xccuy; 0xb7uy; 0x04uy; 0x0fuy; 0xb5uy; 0xf5uy; 0xf4uy; 0x3auy; 0xeauy; ] in
assert_norm (List.Tot.length l = 32);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let key20_len: (x:UInt32.t { UInt32.v x = B.length key20 }) =
32ul
let tag20: (b: B.buffer UInt8.t { B.length b = 16 /\ B.recallable b }) =
[@inline_let] let l = [ 0xc8uy; 0x5duy; 0x15uy; 0xeduy; 0x44uy; 0xc3uy; 0x78uy; 0xd6uy; 0xb0uy; 0x0euy; 0x23uy; 0x06uy; 0x4cuy; 0x7buy; 0xcduy; 0x51uy; ] in
assert_norm (List.Tot.length l = 16);
B.gcmalloc_of_list HyperStack.root l
inline_for_extraction let tag20_len: (x:UInt32.t { UInt32.v x = B.length tag20 }) =
16ul | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Test.Vectors.Poly1305.fst"
} | [
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Test.Vectors",
"short_module": null
},
{
"abbrev": false,
"full_module": "Test.Vectors",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | b:
LowStar.Buffer.buffer FStar.UInt8.t
{LowStar.Monotonic.Buffer.length b = 528 /\ LowStar.Monotonic.Buffer.recallable b} | Prims.Tot | [
"total"
] | [] | [
"LowStar.Buffer.gcmalloc_of_list",
"FStar.UInt8.t",
"FStar.Monotonic.HyperHeap.root",
"LowStar.Monotonic.Buffer.mbuffer",
"LowStar.Buffer.trivial_preorder",
"Prims.l_and",
"Prims.eq2",
"Prims.nat",
"LowStar.Monotonic.Buffer.length",
"FStar.Pervasives.normalize_term",
"FStar.List.Tot.Base.length",
"Prims.b2t",
"Prims.op_Negation",
"LowStar.Monotonic.Buffer.g_is_null",
"FStar.Monotonic.HyperHeap.rid",
"LowStar.Monotonic.Buffer.frameOf",
"LowStar.Monotonic.Buffer.recallable",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.op_Equality",
"Prims.int",
"LowStar.Buffer.buffer",
"Prims.list",
"Prims.Cons",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | false | false | false | false | false | let input21:(b: B.buffer UInt8.t {B.length b = 528 /\ B.recallable b}) =
| [@@ inline_let ]let l =
[
0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x0buy; 0x17uy; 0x03uy; 0x03uy; 0x02uy;
0x00uy; 0x00uy; 0x00uy; 0x00uy; 0x06uy; 0xdbuy; 0x1fuy; 0x1fuy; 0x36uy; 0x8duy; 0x69uy; 0x6auy;
0x81uy; 0x0auy; 0x34uy; 0x9cuy; 0x0cuy; 0x71uy; 0x4cuy; 0x9auy; 0x5euy; 0x78uy; 0x50uy; 0xc2uy;
0x40uy; 0x7duy; 0x72uy; 0x1auy; 0xcduy; 0xeduy; 0x95uy; 0xe0uy; 0x18uy; 0xd7uy; 0xa8uy; 0x52uy;
0x66uy; 0xa6uy; 0xe1uy; 0x28uy; 0x9cuy; 0xdbuy; 0x4auy; 0xebuy; 0x18uy; 0xdauy; 0x5auy; 0xc8uy;
0xa2uy; 0xb0uy; 0x02uy; 0x6duy; 0x24uy; 0xa5uy; 0x9auy; 0xd4uy; 0x85uy; 0x22uy; 0x7fuy; 0x3euy;
0xaeuy; 0xdbuy; 0xb2uy; 0xe7uy; 0xe3uy; 0x5euy; 0x1cuy; 0x66uy; 0xcduy; 0x60uy; 0xf9uy; 0xabuy;
0xf7uy; 0x16uy; 0xdcuy; 0xc9uy; 0xacuy; 0x42uy; 0x68uy; 0x2duy; 0xd7uy; 0xdauy; 0xb2uy; 0x87uy;
0xa7uy; 0x02uy; 0x4cuy; 0x4euy; 0xefuy; 0xc3uy; 0x21uy; 0xccuy; 0x05uy; 0x74uy; 0xe1uy; 0x67uy;
0x93uy; 0xe3uy; 0x7cuy; 0xecuy; 0x03uy; 0xc5uy; 0xbduy; 0xa4uy; 0x2buy; 0x54uy; 0xc1uy; 0x14uy;
0xa8uy; 0x0buy; 0x57uy; 0xafuy; 0x26uy; 0x41uy; 0x6cuy; 0x7buy; 0xe7uy; 0x42uy; 0x00uy; 0x5euy;
0x20uy; 0x85uy; 0x5cuy; 0x73uy; 0xe2uy; 0x1duy; 0xc8uy; 0xe2uy; 0xeduy; 0xc9uy; 0xd4uy; 0x35uy;
0xcbuy; 0x6fuy; 0x60uy; 0x59uy; 0x28uy; 0x00uy; 0x11uy; 0xc2uy; 0x70uy; 0xb7uy; 0x15uy; 0x70uy;
0x05uy; 0x1cuy; 0x1cuy; 0x9buy; 0x30uy; 0x52uy; 0x12uy; 0x66uy; 0x20uy; 0xbcuy; 0x1euy; 0x27uy;
0x30uy; 0xfauy; 0x06uy; 0x6cuy; 0x7auy; 0x50uy; 0x9duy; 0x53uy; 0xc6uy; 0x0euy; 0x5auy; 0xe1uy;
0xb4uy; 0x0auy; 0xa6uy; 0xe3uy; 0x9euy; 0x49uy; 0x66uy; 0x92uy; 0x28uy; 0xc9uy; 0x0euy; 0xecuy;
0xb4uy; 0xa5uy; 0x0duy; 0xb3uy; 0x2auy; 0x50uy; 0xbcuy; 0x49uy; 0xe9uy; 0x0buy; 0x4fuy; 0x4buy;
0x35uy; 0x9auy; 0x1duy; 0xfduy; 0x11uy; 0x74uy; 0x9cuy; 0xd3uy; 0x86uy; 0x7fuy; 0xcfuy; 0x2fuy;
0xb7uy; 0xbbuy; 0x6cuy; 0xd4uy; 0x73uy; 0x8fuy; 0x6auy; 0x4auy; 0xd6uy; 0xf7uy; 0xcauy; 0x50uy;
0x58uy; 0xf7uy; 0x61uy; 0x88uy; 0x45uy; 0xafuy; 0x9fuy; 0x02uy; 0x0fuy; 0x6cuy; 0x3buy; 0x96uy;
0x7buy; 0x8fuy; 0x4cuy; 0xd4uy; 0xa9uy; 0x1euy; 0x28uy; 0x13uy; 0xb5uy; 0x07uy; 0xaeuy; 0x66uy;
0xf2uy; 0xd3uy; 0x5cuy; 0x18uy; 0x28uy; 0x4fuy; 0x72uy; 0x92uy; 0x18uy; 0x60uy; 0x62uy; 0xe1uy;
0x0fuy; 0xd5uy; 0x51uy; 0x0duy; 0x18uy; 0x77uy; 0x53uy; 0x51uy; 0xefuy; 0x33uy; 0x4euy; 0x76uy;
0x34uy; 0xabuy; 0x47uy; 0x43uy; 0xf5uy; 0xb6uy; 0x8fuy; 0x49uy; 0xaduy; 0xcauy; 0xb3uy; 0x84uy;
0xd3uy; 0xfduy; 0x75uy; 0xf7uy; 0x39uy; 0x0fuy; 0x40uy; 0x06uy; 0xefuy; 0x2auy; 0x29uy; 0x5cuy;
0x8cuy; 0x7auy; 0x07uy; 0x6auy; 0xd5uy; 0x45uy; 0x46uy; 0xcduy; 0x25uy; 0xd2uy; 0x10uy; 0x7fuy;
0xbeuy; 0x14uy; 0x36uy; 0xc8uy; 0x40uy; 0x92uy; 0x4auy; 0xaeuy; 0xbeuy; 0x5buy; 0x37uy; 0x08uy;
0x93uy; 0xcduy; 0x63uy; 0xd1uy; 0x32uy; 0x5buy; 0x86uy; 0x16uy; 0xfcuy; 0x48uy; 0x10uy; 0x88uy;
0x6buy; 0xc1uy; 0x52uy; 0xc5uy; 0x32uy; 0x21uy; 0xb6uy; 0xdfuy; 0x37uy; 0x31uy; 0x19uy; 0x39uy;
0x32uy; 0x55uy; 0xeeuy; 0x72uy; 0xbcuy; 0xaauy; 0x88uy; 0x01uy; 0x74uy; 0xf1uy; 0x71uy; 0x7fuy;
0x91uy; 0x84uy; 0xfauy; 0x91uy; 0x64uy; 0x6fuy; 0x17uy; 0xa2uy; 0x4auy; 0xc5uy; 0x5duy; 0x16uy;
0xbfuy; 0xdduy; 0xcauy; 0x95uy; 0x81uy; 0xa9uy; 0x2euy; 0xdauy; 0x47uy; 0x92uy; 0x01uy; 0xf0uy;
0xeduy; 0xbfuy; 0x63uy; 0x36uy; 0x00uy; 0xd6uy; 0x06uy; 0x6duy; 0x1auy; 0xb3uy; 0x6duy; 0x5duy;
0x24uy; 0x15uy; 0xd7uy; 0x13uy; 0x51uy; 0xbbuy; 0xcduy; 0x60uy; 0x8auy; 0x25uy; 0x10uy; 0x8duy;
0x25uy; 0x64uy; 0x19uy; 0x92uy; 0xc1uy; 0xf2uy; 0x6cuy; 0x53uy; 0x1cuy; 0xf9uy; 0xf9uy; 0x02uy;
0x03uy; 0xbcuy; 0x4cuy; 0xc1uy; 0x9fuy; 0x59uy; 0x27uy; 0xd8uy; 0x34uy; 0xb0uy; 0xa4uy; 0x71uy;
0x16uy; 0xd3uy; 0x88uy; 0x4buy; 0xbbuy; 0x16uy; 0x4buy; 0x8euy; 0xc8uy; 0x83uy; 0xd1uy; 0xacuy;
0x83uy; 0x2euy; 0x56uy; 0xb3uy; 0x91uy; 0x8auy; 0x98uy; 0x60uy; 0x1auy; 0x08uy; 0xd1uy; 0x71uy;
0x88uy; 0x15uy; 0x41uy; 0xd5uy; 0x94uy; 0xdbuy; 0x39uy; 0x9cuy; 0x6auy; 0xe6uy; 0x15uy; 0x12uy;
0x21uy; 0x74uy; 0x5auy; 0xecuy; 0x81uy; 0x4cuy; 0x45uy; 0xb0uy; 0xb0uy; 0x5buy; 0x56uy; 0x54uy;
0x36uy; 0xfduy; 0x6fuy; 0x13uy; 0x7auy; 0xa1uy; 0x0auy; 0x0cuy; 0x0buy; 0x64uy; 0x37uy; 0x61uy;
0xdbuy; 0xd6uy; 0xf9uy; 0xa9uy; 0xdcuy; 0xb9uy; 0x9buy; 0x1auy; 0x6euy; 0x69uy; 0x08uy; 0x54uy;
0xceuy; 0x07uy; 0x69uy; 0xcduy; 0xe3uy; 0x97uy; 0x61uy; 0xd8uy; 0x2fuy; 0xcduy; 0xecuy; 0x15uy;
0xf0uy; 0xd9uy; 0x2duy; 0x7duy; 0x8euy; 0x94uy; 0xaduy; 0xe8uy; 0xebuy; 0x83uy; 0xfbuy; 0xe0uy
]
in
assert_norm (List.Tot.length l = 528);
B.gcmalloc_of_list HyperStack.root l | false |
MiniParse.Spec.TEnum.fst | MiniParse.Spec.TEnum.gen_synth' | val gen_synth' (t vt: T.term) : T.Tac T.term | val gen_synth' (t vt: T.term) : T.Tac T.term | let gen_synth' (t: T.term) (vt: T.term) : T.Tac T.term =
let cts = get_inductive_constructors t in
T.debug ("Inductive type with " ^ string_of_int (List.Tot.length cts));
let f = mk_function t (mk_tenum_branches t vt 0 [] cts) in
T.debug (T.term_to_string f);
f | {
"file_name": "examples/miniparse/MiniParse.Spec.TEnum.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 3,
"end_line": 73,
"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 MiniParse.Spec.TEnum
include MiniParse.Spec.Combinators
include MiniParse.Tac.Base
include MiniParse.Spec.Int
module T = FStar.Tactics.V2
module U16 = FStar.UInt16
let rec mk_tenum_branches (ty: T.term) (vty: T.term) (v: nat) (accu: list T.branch) (l: list T.name) : T.Tac (list T.branch) =
match l with
| [] -> accu
| n :: q ->
let v' = v + 1 in
let env = T.cur_env () in
let v = T.mk_app (`(mk_u16)) [pack_nat v, T.Q_Explicit] in
let v = T.pack (T.Tv_AscribedT v vty None false) in
let pat =
T.Pat_Cons {head=T.pack_fv n; univs=None; subpats=[]}
in
let br : T.branch = (pat, v) in
let accu' = br :: accu in
begin match q with
| [] ->
let nv : T.namedv = T.fresh_namedv () in
let pat = T.Pat_Var {v = nv; sort=Sealed.seal ty} in
let br = (pat, v) in
accu' `List.Tot.append` [br]
| _ -> mk_tenum_branches ty vty v' accu' q
end
let mk_function (t: T.term) (l: list T.branch) : T.Tac T.term =
let b = T.fresh_binder t in
let body = T.pack (T.Tv_Match (T.pack (T.Tv_Var (T.binder_to_namedv b))) None l) in
T.pack (T.Tv_Abs b body)
let get_inductive_constructors (t: T.term) : T.Tac (list T.name) =
let v : T.term_view = T.inspect t in
match v with
| T.Tv_FVar w ->
let u = T.inspect_fv w in
let env = T.cur_env () in
let s : option T.sigelt = T.lookup_typ env u in
if None? s then
T.fail "No definition found"
else begin
let v : T.sigelt_view = T.inspect_sigelt (Some?.v s) in
match v with
| T.Sg_Inductive {ctors} -> T.map (fun ct -> fst ct) ctors
| _ -> T.fail "Not an inductive type"
end
| _ -> T.fail "Not a free variable" | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MiniParse.Tac.Base.fst.checked",
"MiniParse.Spec.Int.fst.checked",
"MiniParse.Spec.Combinators.fst.checked",
"FStar.UInt16.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "MiniParse.Spec.TEnum.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt16",
"short_module": "U16"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Tac.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: FStar.Tactics.NamedView.term -> vt: FStar.Tactics.NamedView.term
-> FStar.Tactics.Effect.Tac FStar.Tactics.NamedView.term | FStar.Tactics.Effect.Tac | [] | [] | [
"FStar.Tactics.NamedView.term",
"Prims.unit",
"FStar.Tactics.V2.Derived.debug",
"Prims.string",
"FStar.Stubs.Tactics.V2.Builtins.term_to_string",
"MiniParse.Spec.TEnum.mk_function",
"Prims.list",
"FStar.Tactics.NamedView.branch",
"MiniParse.Spec.TEnum.mk_tenum_branches",
"Prims.Nil",
"Prims.op_Hat",
"Prims.string_of_int",
"FStar.List.Tot.Base.length",
"FStar.Stubs.Reflection.Types.name",
"MiniParse.Spec.TEnum.get_inductive_constructors"
] | [] | false | true | false | false | false | let gen_synth' (t vt: T.term) : T.Tac T.term =
| let cts = get_inductive_constructors t in
T.debug ("Inductive type with " ^ string_of_int (List.Tot.length cts));
let f = mk_function t (mk_tenum_branches t vt 0 [] cts) in
T.debug (T.term_to_string f);
f | false |
MiniParse.Spec.TEnum.fst | MiniParse.Spec.TEnum.pat_of_term | val pat_of_term (t: T.term) : T.Tac T.pattern | val pat_of_term (t: T.term) : T.Tac T.pattern | let pat_of_term (t: T.term) : T.Tac T.pattern =
let t = T.norm_term_env (T.cur_env ()) [delta; iota; primops] t in
match T.inspect t with
| T.Tv_Const v -> T.Pat_Constant {c=v}
| T.Tv_FVar v -> T.Pat_Cons {head=v; univs=Some []; subpats=[]}
| _ -> T.fail "Not a pattern" | {
"file_name": "examples/miniparse/MiniParse.Spec.TEnum.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 31,
"end_line": 84,
"start_col": 0,
"start_line": 79
} | (*
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 MiniParse.Spec.TEnum
include MiniParse.Spec.Combinators
include MiniParse.Tac.Base
include MiniParse.Spec.Int
module T = FStar.Tactics.V2
module U16 = FStar.UInt16
let rec mk_tenum_branches (ty: T.term) (vty: T.term) (v: nat) (accu: list T.branch) (l: list T.name) : T.Tac (list T.branch) =
match l with
| [] -> accu
| n :: q ->
let v' = v + 1 in
let env = T.cur_env () in
let v = T.mk_app (`(mk_u16)) [pack_nat v, T.Q_Explicit] in
let v = T.pack (T.Tv_AscribedT v vty None false) in
let pat =
T.Pat_Cons {head=T.pack_fv n; univs=None; subpats=[]}
in
let br : T.branch = (pat, v) in
let accu' = br :: accu in
begin match q with
| [] ->
let nv : T.namedv = T.fresh_namedv () in
let pat = T.Pat_Var {v = nv; sort=Sealed.seal ty} in
let br = (pat, v) in
accu' `List.Tot.append` [br]
| _ -> mk_tenum_branches ty vty v' accu' q
end
let mk_function (t: T.term) (l: list T.branch) : T.Tac T.term =
let b = T.fresh_binder t in
let body = T.pack (T.Tv_Match (T.pack (T.Tv_Var (T.binder_to_namedv b))) None l) in
T.pack (T.Tv_Abs b body)
let get_inductive_constructors (t: T.term) : T.Tac (list T.name) =
let v : T.term_view = T.inspect t in
match v with
| T.Tv_FVar w ->
let u = T.inspect_fv w in
let env = T.cur_env () in
let s : option T.sigelt = T.lookup_typ env u in
if None? s then
T.fail "No definition found"
else begin
let v : T.sigelt_view = T.inspect_sigelt (Some?.v s) in
match v with
| T.Sg_Inductive {ctors} -> T.map (fun ct -> fst ct) ctors
| _ -> T.fail "Not an inductive type"
end
| _ -> T.fail "Not a free variable"
let gen_synth' (t: T.term) (vt: T.term) : T.Tac T.term =
let cts = get_inductive_constructors t in
T.debug ("Inductive type with " ^ string_of_int (List.Tot.length cts));
let f = mk_function t (mk_tenum_branches t vt 0 [] cts) in
T.debug (T.term_to_string f);
f
let gen_synth (t: T.term) : T.Tac unit =
T.exact_guard (gen_synth' t (`U16.t));
tconclude () | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MiniParse.Tac.Base.fst.checked",
"MiniParse.Spec.Int.fst.checked",
"MiniParse.Spec.Combinators.fst.checked",
"FStar.UInt16.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "MiniParse.Spec.TEnum.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt16",
"short_module": "U16"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Tac.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac FStar.Tactics.NamedView.pattern | FStar.Tactics.Effect.Tac | [] | [] | [
"FStar.Tactics.NamedView.term",
"FStar.Stubs.Reflection.V2.Data.vconst",
"FStar.Tactics.NamedView.Pat_Constant",
"FStar.Tactics.NamedView.Mkpattern__Pat_Constant__payload",
"FStar.Tactics.NamedView.pattern",
"FStar.Stubs.Reflection.Types.fv",
"FStar.Tactics.NamedView.Pat_Cons",
"FStar.Tactics.NamedView.Mkpattern__Pat_Cons__payload",
"FStar.Pervasives.Native.Some",
"FStar.Stubs.Reflection.V2.Data.universes",
"Prims.Nil",
"FStar.Stubs.Reflection.Types.universe",
"FStar.Pervasives.Native.tuple2",
"Prims.bool",
"FStar.Tactics.NamedView.named_term_view",
"FStar.Tactics.V2.Derived.fail",
"FStar.Tactics.NamedView.inspect",
"FStar.Stubs.Reflection.Types.term",
"FStar.Stubs.Tactics.V2.Builtins.norm_term_env",
"Prims.Cons",
"FStar.Pervasives.norm_step",
"FStar.Pervasives.delta",
"FStar.Pervasives.iota",
"FStar.Pervasives.primops",
"FStar.Stubs.Reflection.Types.env",
"FStar.Tactics.V2.Derived.cur_env"
] | [] | false | true | false | false | false | let pat_of_term (t: T.term) : T.Tac T.pattern =
| let t = T.norm_term_env (T.cur_env ()) [delta; iota; primops] t in
match T.inspect t with
| T.Tv_Const v -> T.Pat_Constant ({ c = v })
| T.Tv_FVar v -> T.Pat_Cons ({ head = v; univs = Some []; subpats = [] })
| _ -> T.fail "Not a pattern" | false |
MiniParse.Spec.TEnum.fst | MiniParse.Spec.TEnum.gen_synth | val gen_synth (t: T.term) : T.Tac unit | val gen_synth (t: T.term) : T.Tac unit | let gen_synth (t: T.term) : T.Tac unit =
T.exact_guard (gen_synth' t (`U16.t));
tconclude () | {
"file_name": "examples/miniparse/MiniParse.Spec.TEnum.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 14,
"end_line": 77,
"start_col": 0,
"start_line": 75
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module MiniParse.Spec.TEnum
include MiniParse.Spec.Combinators
include MiniParse.Tac.Base
include MiniParse.Spec.Int
module T = FStar.Tactics.V2
module U16 = FStar.UInt16
let rec mk_tenum_branches (ty: T.term) (vty: T.term) (v: nat) (accu: list T.branch) (l: list T.name) : T.Tac (list T.branch) =
match l with
| [] -> accu
| n :: q ->
let v' = v + 1 in
let env = T.cur_env () in
let v = T.mk_app (`(mk_u16)) [pack_nat v, T.Q_Explicit] in
let v = T.pack (T.Tv_AscribedT v vty None false) in
let pat =
T.Pat_Cons {head=T.pack_fv n; univs=None; subpats=[]}
in
let br : T.branch = (pat, v) in
let accu' = br :: accu in
begin match q with
| [] ->
let nv : T.namedv = T.fresh_namedv () in
let pat = T.Pat_Var {v = nv; sort=Sealed.seal ty} in
let br = (pat, v) in
accu' `List.Tot.append` [br]
| _ -> mk_tenum_branches ty vty v' accu' q
end
let mk_function (t: T.term) (l: list T.branch) : T.Tac T.term =
let b = T.fresh_binder t in
let body = T.pack (T.Tv_Match (T.pack (T.Tv_Var (T.binder_to_namedv b))) None l) in
T.pack (T.Tv_Abs b body)
let get_inductive_constructors (t: T.term) : T.Tac (list T.name) =
let v : T.term_view = T.inspect t in
match v with
| T.Tv_FVar w ->
let u = T.inspect_fv w in
let env = T.cur_env () in
let s : option T.sigelt = T.lookup_typ env u in
if None? s then
T.fail "No definition found"
else begin
let v : T.sigelt_view = T.inspect_sigelt (Some?.v s) in
match v with
| T.Sg_Inductive {ctors} -> T.map (fun ct -> fst ct) ctors
| _ -> T.fail "Not an inductive type"
end
| _ -> T.fail "Not a free variable"
let gen_synth' (t: T.term) (vt: T.term) : T.Tac T.term =
let cts = get_inductive_constructors t in
T.debug ("Inductive type with " ^ string_of_int (List.Tot.length cts));
let f = mk_function t (mk_tenum_branches t vt 0 [] cts) in
T.debug (T.term_to_string f);
f | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MiniParse.Tac.Base.fst.checked",
"MiniParse.Spec.Int.fst.checked",
"MiniParse.Spec.Combinators.fst.checked",
"FStar.UInt16.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "MiniParse.Spec.TEnum.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt16",
"short_module": "U16"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Tac.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac Prims.unit | FStar.Tactics.Effect.Tac | [] | [] | [
"FStar.Tactics.NamedView.term",
"MiniParse.Tac.Base.tconclude",
"Prims.unit",
"FStar.Tactics.V2.Derived.exact_guard",
"MiniParse.Spec.TEnum.gen_synth'"
] | [] | false | true | false | false | false | let gen_synth (t: T.term) : T.Tac unit =
| T.exact_guard (gen_synth' t (`U16.t));
tconclude () | false |
MiniParse.Spec.TEnum.fst | MiniParse.Spec.TEnum.mk_function | val mk_function (t: T.term) (l: list T.branch) : T.Tac T.term | val mk_function (t: T.term) (l: list T.branch) : T.Tac T.term | let mk_function (t: T.term) (l: list T.branch) : T.Tac T.term =
let b = T.fresh_binder t in
let body = T.pack (T.Tv_Match (T.pack (T.Tv_Var (T.binder_to_namedv b))) None l) in
T.pack (T.Tv_Abs b body) | {
"file_name": "examples/miniparse/MiniParse.Spec.TEnum.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 26,
"end_line": 49,
"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 MiniParse.Spec.TEnum
include MiniParse.Spec.Combinators
include MiniParse.Tac.Base
include MiniParse.Spec.Int
module T = FStar.Tactics.V2
module U16 = FStar.UInt16
let rec mk_tenum_branches (ty: T.term) (vty: T.term) (v: nat) (accu: list T.branch) (l: list T.name) : T.Tac (list T.branch) =
match l with
| [] -> accu
| n :: q ->
let v' = v + 1 in
let env = T.cur_env () in
let v = T.mk_app (`(mk_u16)) [pack_nat v, T.Q_Explicit] in
let v = T.pack (T.Tv_AscribedT v vty None false) in
let pat =
T.Pat_Cons {head=T.pack_fv n; univs=None; subpats=[]}
in
let br : T.branch = (pat, v) in
let accu' = br :: accu in
begin match q with
| [] ->
let nv : T.namedv = T.fresh_namedv () in
let pat = T.Pat_Var {v = nv; sort=Sealed.seal ty} in
let br = (pat, v) in
accu' `List.Tot.append` [br]
| _ -> mk_tenum_branches ty vty v' accu' q
end | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MiniParse.Tac.Base.fst.checked",
"MiniParse.Spec.Int.fst.checked",
"MiniParse.Spec.Combinators.fst.checked",
"FStar.UInt16.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "MiniParse.Spec.TEnum.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt16",
"short_module": "U16"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Tac.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: FStar.Tactics.NamedView.term -> l: Prims.list FStar.Tactics.NamedView.branch
-> FStar.Tactics.Effect.Tac FStar.Tactics.NamedView.term | FStar.Tactics.Effect.Tac | [] | [] | [
"FStar.Tactics.NamedView.term",
"Prims.list",
"FStar.Tactics.NamedView.branch",
"FStar.Tactics.NamedView.pack",
"FStar.Tactics.NamedView.Tv_Abs",
"FStar.Tactics.NamedView.Tv_Match",
"FStar.Tactics.NamedView.Tv_Var",
"FStar.Tactics.V2.SyntaxCoercions.binder_to_namedv",
"FStar.Pervasives.Native.None",
"FStar.Tactics.NamedView.match_returns_ascription",
"FStar.Tactics.NamedView.simple_binder",
"FStar.Tactics.V2.Derived.fresh_binder"
] | [] | false | true | false | false | false | let mk_function (t: T.term) (l: list T.branch) : T.Tac T.term =
| let b = T.fresh_binder t in
let body = T.pack (T.Tv_Match (T.pack (T.Tv_Var (T.binder_to_namedv b))) None l) in
T.pack (T.Tv_Abs b body) | false |
MiniParse.Spec.TEnum.fst | MiniParse.Spec.TEnum.term_of_pat | val term_of_pat (t: T.pattern) : T.Tac (option T.term) | val term_of_pat (t: T.pattern) : T.Tac (option T.term) | let term_of_pat (t: T.pattern) : T.Tac (option T.term) =
match t with
| T.Pat_Constant {c=v} -> Some (T.pack (T.Tv_Const v))
| T.Pat_Cons {head=v; univs=None; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some []; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some us; subpats=[]} -> Some (T.pack (T.Tv_UInst v us))
| _ -> None | {
"file_name": "examples/miniparse/MiniParse.Spec.TEnum.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 13,
"end_line": 92,
"start_col": 0,
"start_line": 86
} | (*
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 MiniParse.Spec.TEnum
include MiniParse.Spec.Combinators
include MiniParse.Tac.Base
include MiniParse.Spec.Int
module T = FStar.Tactics.V2
module U16 = FStar.UInt16
let rec mk_tenum_branches (ty: T.term) (vty: T.term) (v: nat) (accu: list T.branch) (l: list T.name) : T.Tac (list T.branch) =
match l with
| [] -> accu
| n :: q ->
let v' = v + 1 in
let env = T.cur_env () in
let v = T.mk_app (`(mk_u16)) [pack_nat v, T.Q_Explicit] in
let v = T.pack (T.Tv_AscribedT v vty None false) in
let pat =
T.Pat_Cons {head=T.pack_fv n; univs=None; subpats=[]}
in
let br : T.branch = (pat, v) in
let accu' = br :: accu in
begin match q with
| [] ->
let nv : T.namedv = T.fresh_namedv () in
let pat = T.Pat_Var {v = nv; sort=Sealed.seal ty} in
let br = (pat, v) in
accu' `List.Tot.append` [br]
| _ -> mk_tenum_branches ty vty v' accu' q
end
let mk_function (t: T.term) (l: list T.branch) : T.Tac T.term =
let b = T.fresh_binder t in
let body = T.pack (T.Tv_Match (T.pack (T.Tv_Var (T.binder_to_namedv b))) None l) in
T.pack (T.Tv_Abs b body)
let get_inductive_constructors (t: T.term) : T.Tac (list T.name) =
let v : T.term_view = T.inspect t in
match v with
| T.Tv_FVar w ->
let u = T.inspect_fv w in
let env = T.cur_env () in
let s : option T.sigelt = T.lookup_typ env u in
if None? s then
T.fail "No definition found"
else begin
let v : T.sigelt_view = T.inspect_sigelt (Some?.v s) in
match v with
| T.Sg_Inductive {ctors} -> T.map (fun ct -> fst ct) ctors
| _ -> T.fail "Not an inductive type"
end
| _ -> T.fail "Not a free variable"
let gen_synth' (t: T.term) (vt: T.term) : T.Tac T.term =
let cts = get_inductive_constructors t in
T.debug ("Inductive type with " ^ string_of_int (List.Tot.length cts));
let f = mk_function t (mk_tenum_branches t vt 0 [] cts) in
T.debug (T.term_to_string f);
f
let gen_synth (t: T.term) : T.Tac unit =
T.exact_guard (gen_synth' t (`U16.t));
tconclude ()
let pat_of_term (t: T.term) : T.Tac T.pattern =
let t = T.norm_term_env (T.cur_env ()) [delta; iota; primops] t in
match T.inspect t with
| T.Tv_Const v -> T.Pat_Constant {c=v}
| T.Tv_FVar v -> T.Pat_Cons {head=v; univs=Some []; subpats=[]}
| _ -> T.fail "Not a pattern" | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MiniParse.Tac.Base.fst.checked",
"MiniParse.Spec.Int.fst.checked",
"MiniParse.Spec.Combinators.fst.checked",
"FStar.UInt16.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "MiniParse.Spec.TEnum.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt16",
"short_module": "U16"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Tac.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: FStar.Tactics.NamedView.pattern
-> FStar.Tactics.Effect.Tac (FStar.Pervasives.Native.option FStar.Tactics.NamedView.term) | FStar.Tactics.Effect.Tac | [] | [] | [
"FStar.Tactics.NamedView.pattern",
"FStar.Stubs.Reflection.V2.Data.vconst",
"FStar.Pervasives.Native.Some",
"FStar.Tactics.NamedView.term",
"FStar.Tactics.NamedView.pack",
"FStar.Tactics.NamedView.Tv_Const",
"FStar.Stubs.Reflection.Types.fv",
"FStar.Tactics.NamedView.Tv_FVar",
"FStar.Stubs.Reflection.V2.Data.universes",
"FStar.Tactics.NamedView.Tv_UInst",
"FStar.Pervasives.Native.None",
"FStar.Pervasives.Native.option"
] | [] | false | true | false | false | false | let term_of_pat (t: T.pattern) : T.Tac (option T.term) =
| match t with
| T.Pat_Constant { c = v } -> Some (T.pack (T.Tv_Const v))
| T.Pat_Cons { head = v ; univs = None ; subpats = [] } -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons { head = v ; univs = Some [] ; subpats = [] } -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons { head = v ; univs = Some us ; subpats = [] } -> Some (T.pack (T.Tv_UInst v us))
| _ -> None | false |
MiniParse.Spec.TEnum.fst | MiniParse.Spec.TEnum.tenum_bound' | val tenum_bound' (t: T.term) : T.Tac T.term | val tenum_bound' (t: T.term) : T.Tac T.term | let tenum_bound' (t: T.term) : T.Tac T.term =
pack_nat (tenum_bound_nat t) | {
"file_name": "examples/miniparse/MiniParse.Spec.TEnum.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 30,
"end_line": 138,
"start_col": 0,
"start_line": 137
} | (*
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 MiniParse.Spec.TEnum
include MiniParse.Spec.Combinators
include MiniParse.Tac.Base
include MiniParse.Spec.Int
module T = FStar.Tactics.V2
module U16 = FStar.UInt16
let rec mk_tenum_branches (ty: T.term) (vty: T.term) (v: nat) (accu: list T.branch) (l: list T.name) : T.Tac (list T.branch) =
match l with
| [] -> accu
| n :: q ->
let v' = v + 1 in
let env = T.cur_env () in
let v = T.mk_app (`(mk_u16)) [pack_nat v, T.Q_Explicit] in
let v = T.pack (T.Tv_AscribedT v vty None false) in
let pat =
T.Pat_Cons {head=T.pack_fv n; univs=None; subpats=[]}
in
let br : T.branch = (pat, v) in
let accu' = br :: accu in
begin match q with
| [] ->
let nv : T.namedv = T.fresh_namedv () in
let pat = T.Pat_Var {v = nv; sort=Sealed.seal ty} in
let br = (pat, v) in
accu' `List.Tot.append` [br]
| _ -> mk_tenum_branches ty vty v' accu' q
end
let mk_function (t: T.term) (l: list T.branch) : T.Tac T.term =
let b = T.fresh_binder t in
let body = T.pack (T.Tv_Match (T.pack (T.Tv_Var (T.binder_to_namedv b))) None l) in
T.pack (T.Tv_Abs b body)
let get_inductive_constructors (t: T.term) : T.Tac (list T.name) =
let v : T.term_view = T.inspect t in
match v with
| T.Tv_FVar w ->
let u = T.inspect_fv w in
let env = T.cur_env () in
let s : option T.sigelt = T.lookup_typ env u in
if None? s then
T.fail "No definition found"
else begin
let v : T.sigelt_view = T.inspect_sigelt (Some?.v s) in
match v with
| T.Sg_Inductive {ctors} -> T.map (fun ct -> fst ct) ctors
| _ -> T.fail "Not an inductive type"
end
| _ -> T.fail "Not a free variable"
let gen_synth' (t: T.term) (vt: T.term) : T.Tac T.term =
let cts = get_inductive_constructors t in
T.debug ("Inductive type with " ^ string_of_int (List.Tot.length cts));
let f = mk_function t (mk_tenum_branches t vt 0 [] cts) in
T.debug (T.term_to_string f);
f
let gen_synth (t: T.term) : T.Tac unit =
T.exact_guard (gen_synth' t (`U16.t));
tconclude ()
let pat_of_term (t: T.term) : T.Tac T.pattern =
let t = T.norm_term_env (T.cur_env ()) [delta; iota; primops] t in
match T.inspect t with
| T.Tv_Const v -> T.Pat_Constant {c=v}
| T.Tv_FVar v -> T.Pat_Cons {head=v; univs=Some []; subpats=[]}
| _ -> T.fail "Not a pattern"
let term_of_pat (t: T.pattern) : T.Tac (option T.term) =
match t with
| T.Pat_Constant {c=v} -> Some (T.pack (T.Tv_Const v))
| T.Pat_Cons {head=v; univs=None; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some []; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some us; subpats=[]} -> Some (T.pack (T.Tv_UInst v us))
| _ -> None
let rec invert_branches_with_cascade (enum_ty: T.term) (val_eq: T.term) (x: T.term) (accu: option T.term) (l: list T.branch) : T.Tac T.term =
match l with
| [] ->
begin match accu with
| None -> tfail "There must be at least one branch"
| Some t -> t
end
| (p, t) :: q ->
begin match term_of_pat p with
| Some v ->
let accu' = match accu with
| None -> Some v
| Some ac ->
let scrut = T.mk_app val_eq [
(x, T.Q_Explicit);
(t, T.Q_Explicit);
]
in
Some (mk_if scrut enum_ty v ac)
in
invert_branches_with_cascade enum_ty val_eq x accu' q
| _ -> invert_branches_with_cascade enum_ty val_eq x accu q
end
let invert_function' (enum_ty val_ty: T.term) (teq: T.term) (f: T.term) : T.Tac T.term =
match T.inspect f with
| T.Tv_Abs b body ->
begin match T.inspect body with
| T.Tv_Match t _ br ->
if T.term_eq t (T.pack (T.Tv_Var (T.binder_to_namedv b)))
then
let bx = T.fresh_binder val_ty in
let x = T.pack (T.Tv_Var (T.binder_to_namedv bx)) in
T.pack (T.Tv_Abs bx (invert_branches_with_cascade enum_ty teq x None br))
else T.fail "Not a function destructing on its argument"
| _ -> T.fail "Not a match"
end
| _ -> T.fail "Not a function"
let tenum_bound_nat (t: T.term) : T.Tac nat =
let c = get_inductive_constructors t in
List.Tot.length c | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MiniParse.Tac.Base.fst.checked",
"MiniParse.Spec.Int.fst.checked",
"MiniParse.Spec.Combinators.fst.checked",
"FStar.UInt16.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "MiniParse.Spec.TEnum.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt16",
"short_module": "U16"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Tac.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac FStar.Tactics.NamedView.term | FStar.Tactics.Effect.Tac | [] | [] | [
"FStar.Tactics.NamedView.term",
"MiniParse.Tac.Base.pack_nat",
"Prims.nat",
"MiniParse.Spec.TEnum.tenum_bound_nat"
] | [] | false | true | false | false | false | let tenum_bound' (t: T.term) : T.Tac T.term =
| pack_nat (tenum_bound_nat t) | false |
MiniParse.Spec.TEnum.fst | MiniParse.Spec.TEnum.tenum_bound_nat | val tenum_bound_nat (t: T.term) : T.Tac nat | val tenum_bound_nat (t: T.term) : T.Tac nat | let tenum_bound_nat (t: T.term) : T.Tac nat =
let c = get_inductive_constructors t in
List.Tot.length c | {
"file_name": "examples/miniparse/MiniParse.Spec.TEnum.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 19,
"end_line": 135,
"start_col": 0,
"start_line": 133
} | (*
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 MiniParse.Spec.TEnum
include MiniParse.Spec.Combinators
include MiniParse.Tac.Base
include MiniParse.Spec.Int
module T = FStar.Tactics.V2
module U16 = FStar.UInt16
let rec mk_tenum_branches (ty: T.term) (vty: T.term) (v: nat) (accu: list T.branch) (l: list T.name) : T.Tac (list T.branch) =
match l with
| [] -> accu
| n :: q ->
let v' = v + 1 in
let env = T.cur_env () in
let v = T.mk_app (`(mk_u16)) [pack_nat v, T.Q_Explicit] in
let v = T.pack (T.Tv_AscribedT v vty None false) in
let pat =
T.Pat_Cons {head=T.pack_fv n; univs=None; subpats=[]}
in
let br : T.branch = (pat, v) in
let accu' = br :: accu in
begin match q with
| [] ->
let nv : T.namedv = T.fresh_namedv () in
let pat = T.Pat_Var {v = nv; sort=Sealed.seal ty} in
let br = (pat, v) in
accu' `List.Tot.append` [br]
| _ -> mk_tenum_branches ty vty v' accu' q
end
let mk_function (t: T.term) (l: list T.branch) : T.Tac T.term =
let b = T.fresh_binder t in
let body = T.pack (T.Tv_Match (T.pack (T.Tv_Var (T.binder_to_namedv b))) None l) in
T.pack (T.Tv_Abs b body)
let get_inductive_constructors (t: T.term) : T.Tac (list T.name) =
let v : T.term_view = T.inspect t in
match v with
| T.Tv_FVar w ->
let u = T.inspect_fv w in
let env = T.cur_env () in
let s : option T.sigelt = T.lookup_typ env u in
if None? s then
T.fail "No definition found"
else begin
let v : T.sigelt_view = T.inspect_sigelt (Some?.v s) in
match v with
| T.Sg_Inductive {ctors} -> T.map (fun ct -> fst ct) ctors
| _ -> T.fail "Not an inductive type"
end
| _ -> T.fail "Not a free variable"
let gen_synth' (t: T.term) (vt: T.term) : T.Tac T.term =
let cts = get_inductive_constructors t in
T.debug ("Inductive type with " ^ string_of_int (List.Tot.length cts));
let f = mk_function t (mk_tenum_branches t vt 0 [] cts) in
T.debug (T.term_to_string f);
f
let gen_synth (t: T.term) : T.Tac unit =
T.exact_guard (gen_synth' t (`U16.t));
tconclude ()
let pat_of_term (t: T.term) : T.Tac T.pattern =
let t = T.norm_term_env (T.cur_env ()) [delta; iota; primops] t in
match T.inspect t with
| T.Tv_Const v -> T.Pat_Constant {c=v}
| T.Tv_FVar v -> T.Pat_Cons {head=v; univs=Some []; subpats=[]}
| _ -> T.fail "Not a pattern"
let term_of_pat (t: T.pattern) : T.Tac (option T.term) =
match t with
| T.Pat_Constant {c=v} -> Some (T.pack (T.Tv_Const v))
| T.Pat_Cons {head=v; univs=None; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some []; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some us; subpats=[]} -> Some (T.pack (T.Tv_UInst v us))
| _ -> None
let rec invert_branches_with_cascade (enum_ty: T.term) (val_eq: T.term) (x: T.term) (accu: option T.term) (l: list T.branch) : T.Tac T.term =
match l with
| [] ->
begin match accu with
| None -> tfail "There must be at least one branch"
| Some t -> t
end
| (p, t) :: q ->
begin match term_of_pat p with
| Some v ->
let accu' = match accu with
| None -> Some v
| Some ac ->
let scrut = T.mk_app val_eq [
(x, T.Q_Explicit);
(t, T.Q_Explicit);
]
in
Some (mk_if scrut enum_ty v ac)
in
invert_branches_with_cascade enum_ty val_eq x accu' q
| _ -> invert_branches_with_cascade enum_ty val_eq x accu q
end
let invert_function' (enum_ty val_ty: T.term) (teq: T.term) (f: T.term) : T.Tac T.term =
match T.inspect f with
| T.Tv_Abs b body ->
begin match T.inspect body with
| T.Tv_Match t _ br ->
if T.term_eq t (T.pack (T.Tv_Var (T.binder_to_namedv b)))
then
let bx = T.fresh_binder val_ty in
let x = T.pack (T.Tv_Var (T.binder_to_namedv bx)) in
T.pack (T.Tv_Abs bx (invert_branches_with_cascade enum_ty teq x None br))
else T.fail "Not a function destructing on its argument"
| _ -> T.fail "Not a match"
end
| _ -> T.fail "Not a function" | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MiniParse.Tac.Base.fst.checked",
"MiniParse.Spec.Int.fst.checked",
"MiniParse.Spec.Combinators.fst.checked",
"FStar.UInt16.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "MiniParse.Spec.TEnum.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt16",
"short_module": "U16"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Tac.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac Prims.nat | FStar.Tactics.Effect.Tac | [] | [] | [
"FStar.Tactics.NamedView.term",
"FStar.List.Tot.Base.length",
"FStar.Stubs.Reflection.Types.name",
"Prims.nat",
"Prims.list",
"MiniParse.Spec.TEnum.get_inductive_constructors"
] | [] | false | true | false | false | false | let tenum_bound_nat (t: T.term) : T.Tac nat =
| let c = get_inductive_constructors t in
List.Tot.length c | false |
MiniParse.Spec.TEnum.fst | MiniParse.Spec.TEnum.gen_synth_bounded' | val gen_synth_bounded' (t: T.term) : T.Tac T.term | val gen_synth_bounded' (t: T.term) : T.Tac T.term | let gen_synth_bounded' (t: T.term) : T.Tac T.term =
let bound = tenum_bound' t in
let vt = T.mk_app (`bounded_u16) [bound, T.Q_Explicit] in
gen_synth' t vt | {
"file_name": "examples/miniparse/MiniParse.Spec.TEnum.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 17,
"end_line": 146,
"start_col": 0,
"start_line": 143
} | (*
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 MiniParse.Spec.TEnum
include MiniParse.Spec.Combinators
include MiniParse.Tac.Base
include MiniParse.Spec.Int
module T = FStar.Tactics.V2
module U16 = FStar.UInt16
let rec mk_tenum_branches (ty: T.term) (vty: T.term) (v: nat) (accu: list T.branch) (l: list T.name) : T.Tac (list T.branch) =
match l with
| [] -> accu
| n :: q ->
let v' = v + 1 in
let env = T.cur_env () in
let v = T.mk_app (`(mk_u16)) [pack_nat v, T.Q_Explicit] in
let v = T.pack (T.Tv_AscribedT v vty None false) in
let pat =
T.Pat_Cons {head=T.pack_fv n; univs=None; subpats=[]}
in
let br : T.branch = (pat, v) in
let accu' = br :: accu in
begin match q with
| [] ->
let nv : T.namedv = T.fresh_namedv () in
let pat = T.Pat_Var {v = nv; sort=Sealed.seal ty} in
let br = (pat, v) in
accu' `List.Tot.append` [br]
| _ -> mk_tenum_branches ty vty v' accu' q
end
let mk_function (t: T.term) (l: list T.branch) : T.Tac T.term =
let b = T.fresh_binder t in
let body = T.pack (T.Tv_Match (T.pack (T.Tv_Var (T.binder_to_namedv b))) None l) in
T.pack (T.Tv_Abs b body)
let get_inductive_constructors (t: T.term) : T.Tac (list T.name) =
let v : T.term_view = T.inspect t in
match v with
| T.Tv_FVar w ->
let u = T.inspect_fv w in
let env = T.cur_env () in
let s : option T.sigelt = T.lookup_typ env u in
if None? s then
T.fail "No definition found"
else begin
let v : T.sigelt_view = T.inspect_sigelt (Some?.v s) in
match v with
| T.Sg_Inductive {ctors} -> T.map (fun ct -> fst ct) ctors
| _ -> T.fail "Not an inductive type"
end
| _ -> T.fail "Not a free variable"
let gen_synth' (t: T.term) (vt: T.term) : T.Tac T.term =
let cts = get_inductive_constructors t in
T.debug ("Inductive type with " ^ string_of_int (List.Tot.length cts));
let f = mk_function t (mk_tenum_branches t vt 0 [] cts) in
T.debug (T.term_to_string f);
f
let gen_synth (t: T.term) : T.Tac unit =
T.exact_guard (gen_synth' t (`U16.t));
tconclude ()
let pat_of_term (t: T.term) : T.Tac T.pattern =
let t = T.norm_term_env (T.cur_env ()) [delta; iota; primops] t in
match T.inspect t with
| T.Tv_Const v -> T.Pat_Constant {c=v}
| T.Tv_FVar v -> T.Pat_Cons {head=v; univs=Some []; subpats=[]}
| _ -> T.fail "Not a pattern"
let term_of_pat (t: T.pattern) : T.Tac (option T.term) =
match t with
| T.Pat_Constant {c=v} -> Some (T.pack (T.Tv_Const v))
| T.Pat_Cons {head=v; univs=None; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some []; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some us; subpats=[]} -> Some (T.pack (T.Tv_UInst v us))
| _ -> None
let rec invert_branches_with_cascade (enum_ty: T.term) (val_eq: T.term) (x: T.term) (accu: option T.term) (l: list T.branch) : T.Tac T.term =
match l with
| [] ->
begin match accu with
| None -> tfail "There must be at least one branch"
| Some t -> t
end
| (p, t) :: q ->
begin match term_of_pat p with
| Some v ->
let accu' = match accu with
| None -> Some v
| Some ac ->
let scrut = T.mk_app val_eq [
(x, T.Q_Explicit);
(t, T.Q_Explicit);
]
in
Some (mk_if scrut enum_ty v ac)
in
invert_branches_with_cascade enum_ty val_eq x accu' q
| _ -> invert_branches_with_cascade enum_ty val_eq x accu q
end
let invert_function' (enum_ty val_ty: T.term) (teq: T.term) (f: T.term) : T.Tac T.term =
match T.inspect f with
| T.Tv_Abs b body ->
begin match T.inspect body with
| T.Tv_Match t _ br ->
if T.term_eq t (T.pack (T.Tv_Var (T.binder_to_namedv b)))
then
let bx = T.fresh_binder val_ty in
let x = T.pack (T.Tv_Var (T.binder_to_namedv bx)) in
T.pack (T.Tv_Abs bx (invert_branches_with_cascade enum_ty teq x None br))
else T.fail "Not a function destructing on its argument"
| _ -> T.fail "Not a match"
end
| _ -> T.fail "Not a function"
let tenum_bound_nat (t: T.term) : T.Tac nat =
let c = get_inductive_constructors t in
List.Tot.length c
let tenum_bound' (t: T.term) : T.Tac T.term =
pack_nat (tenum_bound_nat t)
let tenum_bound (t: T.term) : T.Tac unit =
T.exact (tenum_bound' t) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MiniParse.Tac.Base.fst.checked",
"MiniParse.Spec.Int.fst.checked",
"MiniParse.Spec.Combinators.fst.checked",
"FStar.UInt16.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "MiniParse.Spec.TEnum.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt16",
"short_module": "U16"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Tac.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac FStar.Tactics.NamedView.term | FStar.Tactics.Effect.Tac | [] | [] | [
"FStar.Tactics.NamedView.term",
"MiniParse.Spec.TEnum.gen_synth'",
"FStar.Stubs.Reflection.Types.term",
"FStar.Reflection.V2.Derived.mk_app",
"Prims.Cons",
"FStar.Stubs.Reflection.V2.Data.argv",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Stubs.Reflection.V2.Data.aqualv",
"FStar.Stubs.Reflection.V2.Data.Q_Explicit",
"Prims.Nil",
"MiniParse.Spec.TEnum.tenum_bound'"
] | [] | false | true | false | false | false | let gen_synth_bounded' (t: T.term) : T.Tac T.term =
| let bound = tenum_bound' t in
let vt = T.mk_app (`bounded_u16) [bound, T.Q_Explicit] in
gen_synth' t vt | false |
MiniParse.Spec.TEnum.fst | MiniParse.Spec.TEnum.synth_inverse_forall_bounded_u16' | val synth_inverse_forall_bounded_u16'
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
: GTot Type0 | val synth_inverse_forall_bounded_u16'
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
: GTot Type0 | let synth_inverse_forall_bounded_u16'
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
: GTot Type0
= forall_bounded_u16 b (synth_inverse_forall_bounded_u16_pred b t f1 f2) | {
"file_name": "examples/miniparse/MiniParse.Spec.TEnum.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 72,
"end_line": 163,
"start_col": 0,
"start_line": 157
} | (*
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 MiniParse.Spec.TEnum
include MiniParse.Spec.Combinators
include MiniParse.Tac.Base
include MiniParse.Spec.Int
module T = FStar.Tactics.V2
module U16 = FStar.UInt16
let rec mk_tenum_branches (ty: T.term) (vty: T.term) (v: nat) (accu: list T.branch) (l: list T.name) : T.Tac (list T.branch) =
match l with
| [] -> accu
| n :: q ->
let v' = v + 1 in
let env = T.cur_env () in
let v = T.mk_app (`(mk_u16)) [pack_nat v, T.Q_Explicit] in
let v = T.pack (T.Tv_AscribedT v vty None false) in
let pat =
T.Pat_Cons {head=T.pack_fv n; univs=None; subpats=[]}
in
let br : T.branch = (pat, v) in
let accu' = br :: accu in
begin match q with
| [] ->
let nv : T.namedv = T.fresh_namedv () in
let pat = T.Pat_Var {v = nv; sort=Sealed.seal ty} in
let br = (pat, v) in
accu' `List.Tot.append` [br]
| _ -> mk_tenum_branches ty vty v' accu' q
end
let mk_function (t: T.term) (l: list T.branch) : T.Tac T.term =
let b = T.fresh_binder t in
let body = T.pack (T.Tv_Match (T.pack (T.Tv_Var (T.binder_to_namedv b))) None l) in
T.pack (T.Tv_Abs b body)
let get_inductive_constructors (t: T.term) : T.Tac (list T.name) =
let v : T.term_view = T.inspect t in
match v with
| T.Tv_FVar w ->
let u = T.inspect_fv w in
let env = T.cur_env () in
let s : option T.sigelt = T.lookup_typ env u in
if None? s then
T.fail "No definition found"
else begin
let v : T.sigelt_view = T.inspect_sigelt (Some?.v s) in
match v with
| T.Sg_Inductive {ctors} -> T.map (fun ct -> fst ct) ctors
| _ -> T.fail "Not an inductive type"
end
| _ -> T.fail "Not a free variable"
let gen_synth' (t: T.term) (vt: T.term) : T.Tac T.term =
let cts = get_inductive_constructors t in
T.debug ("Inductive type with " ^ string_of_int (List.Tot.length cts));
let f = mk_function t (mk_tenum_branches t vt 0 [] cts) in
T.debug (T.term_to_string f);
f
let gen_synth (t: T.term) : T.Tac unit =
T.exact_guard (gen_synth' t (`U16.t));
tconclude ()
let pat_of_term (t: T.term) : T.Tac T.pattern =
let t = T.norm_term_env (T.cur_env ()) [delta; iota; primops] t in
match T.inspect t with
| T.Tv_Const v -> T.Pat_Constant {c=v}
| T.Tv_FVar v -> T.Pat_Cons {head=v; univs=Some []; subpats=[]}
| _ -> T.fail "Not a pattern"
let term_of_pat (t: T.pattern) : T.Tac (option T.term) =
match t with
| T.Pat_Constant {c=v} -> Some (T.pack (T.Tv_Const v))
| T.Pat_Cons {head=v; univs=None; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some []; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some us; subpats=[]} -> Some (T.pack (T.Tv_UInst v us))
| _ -> None
let rec invert_branches_with_cascade (enum_ty: T.term) (val_eq: T.term) (x: T.term) (accu: option T.term) (l: list T.branch) : T.Tac T.term =
match l with
| [] ->
begin match accu with
| None -> tfail "There must be at least one branch"
| Some t -> t
end
| (p, t) :: q ->
begin match term_of_pat p with
| Some v ->
let accu' = match accu with
| None -> Some v
| Some ac ->
let scrut = T.mk_app val_eq [
(x, T.Q_Explicit);
(t, T.Q_Explicit);
]
in
Some (mk_if scrut enum_ty v ac)
in
invert_branches_with_cascade enum_ty val_eq x accu' q
| _ -> invert_branches_with_cascade enum_ty val_eq x accu q
end
let invert_function' (enum_ty val_ty: T.term) (teq: T.term) (f: T.term) : T.Tac T.term =
match T.inspect f with
| T.Tv_Abs b body ->
begin match T.inspect body with
| T.Tv_Match t _ br ->
if T.term_eq t (T.pack (T.Tv_Var (T.binder_to_namedv b)))
then
let bx = T.fresh_binder val_ty in
let x = T.pack (T.Tv_Var (T.binder_to_namedv bx)) in
T.pack (T.Tv_Abs bx (invert_branches_with_cascade enum_ty teq x None br))
else T.fail "Not a function destructing on its argument"
| _ -> T.fail "Not a match"
end
| _ -> T.fail "Not a function"
let tenum_bound_nat (t: T.term) : T.Tac nat =
let c = get_inductive_constructors t in
List.Tot.length c
let tenum_bound' (t: T.term) : T.Tac T.term =
pack_nat (tenum_bound_nat t)
let tenum_bound (t: T.term) : T.Tac unit =
T.exact (tenum_bound' t)
let gen_synth_bounded' (t: T.term) : T.Tac T.term =
let bound = tenum_bound' t in
let vt = T.mk_app (`bounded_u16) [bound, T.Q_Explicit] in
gen_synth' t vt
let synth_inverse_forall_bounded_u16_pred
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
(x: bounded_u16 b)
: GTot Type0
= f2 (f1 x) == x | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MiniParse.Tac.Base.fst.checked",
"MiniParse.Spec.Int.fst.checked",
"MiniParse.Spec.Combinators.fst.checked",
"FStar.UInt16.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "MiniParse.Spec.TEnum.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt16",
"short_module": "U16"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Tac.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
b: Prims.nat ->
t: Type ->
f1: (_: MiniParse.Spec.Int.bounded_u16 b -> Prims.GTot t) ->
f2: (_: t -> Prims.GTot (MiniParse.Spec.Int.bounded_u16 b))
-> Prims.GTot Type0 | Prims.GTot | [
"sometrivial"
] | [] | [
"Prims.nat",
"MiniParse.Spec.Int.bounded_u16",
"MiniParse.Spec.Int.forall_bounded_u16",
"MiniParse.Spec.TEnum.synth_inverse_forall_bounded_u16_pred"
] | [] | false | false | false | false | true | let synth_inverse_forall_bounded_u16'
(b: nat)
(t: Type)
(f1: (bounded_u16 b -> GTot t))
(f2: (t -> GTot (bounded_u16 b)))
: GTot Type0 =
| forall_bounded_u16 b (synth_inverse_forall_bounded_u16_pred b t f1 f2) | false |
MiniParse.Spec.TEnum.fst | MiniParse.Spec.TEnum.tenum_bound | val tenum_bound (t: T.term) : T.Tac unit | val tenum_bound (t: T.term) : T.Tac unit | let tenum_bound (t: T.term) : T.Tac unit =
T.exact (tenum_bound' t) | {
"file_name": "examples/miniparse/MiniParse.Spec.TEnum.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 26,
"end_line": 141,
"start_col": 0,
"start_line": 140
} | (*
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 MiniParse.Spec.TEnum
include MiniParse.Spec.Combinators
include MiniParse.Tac.Base
include MiniParse.Spec.Int
module T = FStar.Tactics.V2
module U16 = FStar.UInt16
let rec mk_tenum_branches (ty: T.term) (vty: T.term) (v: nat) (accu: list T.branch) (l: list T.name) : T.Tac (list T.branch) =
match l with
| [] -> accu
| n :: q ->
let v' = v + 1 in
let env = T.cur_env () in
let v = T.mk_app (`(mk_u16)) [pack_nat v, T.Q_Explicit] in
let v = T.pack (T.Tv_AscribedT v vty None false) in
let pat =
T.Pat_Cons {head=T.pack_fv n; univs=None; subpats=[]}
in
let br : T.branch = (pat, v) in
let accu' = br :: accu in
begin match q with
| [] ->
let nv : T.namedv = T.fresh_namedv () in
let pat = T.Pat_Var {v = nv; sort=Sealed.seal ty} in
let br = (pat, v) in
accu' `List.Tot.append` [br]
| _ -> mk_tenum_branches ty vty v' accu' q
end
let mk_function (t: T.term) (l: list T.branch) : T.Tac T.term =
let b = T.fresh_binder t in
let body = T.pack (T.Tv_Match (T.pack (T.Tv_Var (T.binder_to_namedv b))) None l) in
T.pack (T.Tv_Abs b body)
let get_inductive_constructors (t: T.term) : T.Tac (list T.name) =
let v : T.term_view = T.inspect t in
match v with
| T.Tv_FVar w ->
let u = T.inspect_fv w in
let env = T.cur_env () in
let s : option T.sigelt = T.lookup_typ env u in
if None? s then
T.fail "No definition found"
else begin
let v : T.sigelt_view = T.inspect_sigelt (Some?.v s) in
match v with
| T.Sg_Inductive {ctors} -> T.map (fun ct -> fst ct) ctors
| _ -> T.fail "Not an inductive type"
end
| _ -> T.fail "Not a free variable"
let gen_synth' (t: T.term) (vt: T.term) : T.Tac T.term =
let cts = get_inductive_constructors t in
T.debug ("Inductive type with " ^ string_of_int (List.Tot.length cts));
let f = mk_function t (mk_tenum_branches t vt 0 [] cts) in
T.debug (T.term_to_string f);
f
let gen_synth (t: T.term) : T.Tac unit =
T.exact_guard (gen_synth' t (`U16.t));
tconclude ()
let pat_of_term (t: T.term) : T.Tac T.pattern =
let t = T.norm_term_env (T.cur_env ()) [delta; iota; primops] t in
match T.inspect t with
| T.Tv_Const v -> T.Pat_Constant {c=v}
| T.Tv_FVar v -> T.Pat_Cons {head=v; univs=Some []; subpats=[]}
| _ -> T.fail "Not a pattern"
let term_of_pat (t: T.pattern) : T.Tac (option T.term) =
match t with
| T.Pat_Constant {c=v} -> Some (T.pack (T.Tv_Const v))
| T.Pat_Cons {head=v; univs=None; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some []; subpats=[]} -> Some (T.pack (T.Tv_FVar v))
| T.Pat_Cons {head=v; univs=Some us; subpats=[]} -> Some (T.pack (T.Tv_UInst v us))
| _ -> None
let rec invert_branches_with_cascade (enum_ty: T.term) (val_eq: T.term) (x: T.term) (accu: option T.term) (l: list T.branch) : T.Tac T.term =
match l with
| [] ->
begin match accu with
| None -> tfail "There must be at least one branch"
| Some t -> t
end
| (p, t) :: q ->
begin match term_of_pat p with
| Some v ->
let accu' = match accu with
| None -> Some v
| Some ac ->
let scrut = T.mk_app val_eq [
(x, T.Q_Explicit);
(t, T.Q_Explicit);
]
in
Some (mk_if scrut enum_ty v ac)
in
invert_branches_with_cascade enum_ty val_eq x accu' q
| _ -> invert_branches_with_cascade enum_ty val_eq x accu q
end
let invert_function' (enum_ty val_ty: T.term) (teq: T.term) (f: T.term) : T.Tac T.term =
match T.inspect f with
| T.Tv_Abs b body ->
begin match T.inspect body with
| T.Tv_Match t _ br ->
if T.term_eq t (T.pack (T.Tv_Var (T.binder_to_namedv b)))
then
let bx = T.fresh_binder val_ty in
let x = T.pack (T.Tv_Var (T.binder_to_namedv bx)) in
T.pack (T.Tv_Abs bx (invert_branches_with_cascade enum_ty teq x None br))
else T.fail "Not a function destructing on its argument"
| _ -> T.fail "Not a match"
end
| _ -> T.fail "Not a function"
let tenum_bound_nat (t: T.term) : T.Tac nat =
let c = get_inductive_constructors t in
List.Tot.length c
let tenum_bound' (t: T.term) : T.Tac T.term =
pack_nat (tenum_bound_nat t) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"MiniParse.Tac.Base.fst.checked",
"MiniParse.Spec.Int.fst.checked",
"MiniParse.Spec.Combinators.fst.checked",
"FStar.UInt16.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "MiniParse.Spec.TEnum.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt16",
"short_module": "U16"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Int",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Tac.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "MiniParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac Prims.unit | FStar.Tactics.Effect.Tac | [] | [] | [
"FStar.Tactics.NamedView.term",
"FStar.Tactics.V2.Derived.exact",
"Prims.unit",
"MiniParse.Spec.TEnum.tenum_bound'"
] | [] | false | true | false | false | false | let tenum_bound (t: T.term) : T.Tac unit =
| T.exact (tenum_bound' t) | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.