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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Hacl.Spec.K256.GLV.fst | Hacl.Spec.K256.GLV.qmul_shift_384_lemma | val qmul_shift_384_lemma (a b:S.qelem) : Lemma (qmul_shift_384 a b < S.q) | val qmul_shift_384_lemma (a b:S.qelem) : Lemma (qmul_shift_384 a b < S.q) | let qmul_shift_384_lemma a b =
assert_norm (S.q < pow2 256);
Math.Lemmas.lemma_mult_lt_sqr a b (pow2 256);
Math.Lemmas.pow2_plus 256 256;
assert (a * b < pow2 512);
Math.Lemmas.lemma_div_lt_nat (a * b) 512 384;
assert (a * b / pow2 384 < pow2 128);
assert_norm (pow2 128 < S.q) | {
"file_name": "code/k256/Hacl.Spec.K256.GLV.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 30,
"end_line": 107,
"start_col": 0,
"start_line": 100
} | module Hacl.Spec.K256.GLV
open FStar.Mul
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
(**
This module implements the following two functions from libsecp256k1:
secp256k1_scalar_split_lambda [1] and secp256k1_ecmult_endo_split [2].
For the secp256k1 curve, we can replace the EC scalar multiplication
by `lambda` with one modular multiplication by `beta`:
[lambda](px, py) = (beta *% px, py) for any point on the curve P = (px, py),
where `lambda` and `beta` are primitive cube roots of unity and can be
fixed for the curve.
The main idea is to slit a 256-bit scalar k into k1 and k2 s.t.
k = (k1 + lambda * k2) % q, where k1 and k2 are 128-bit numbers:
[k]P = [(k1 + lambda * k2) % q]P = [k1]P + [k2]([lambda]P)
= [k1](px, py) + [k2](beta *% px, py).
Using a double fixed-window method, we can save 128 point_double:
| before | after
----------------------------------------------------------------------
point_double | 256 | 128
point_add | 256 / 5 = 51 | 128 / 5 + 128 / 5 + 1 = 25 + 25 + 1 = 51
Note that one precomputed table is enough for [k]P, as [r_small]([lambda]P)
can be obtained via [r_small]P.
[1]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/scalar_impl.h#L123
[2]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/ecmult_impl.h#L618
*)
(**
Fast computation of [lambda]P as (beta * x, y) in affine and projective coordinates
*)
let lambda : S.qelem = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72
let beta : S.felem = 0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee
// [a]P in affine coordinates
let aff_point_mul = S.aff_point_mul
// fast computation of [lambda]P in affine coordinates
let aff_point_mul_lambda (p:S.aff_point) : S.aff_point =
let (px, py) = p in (S.(beta *% px), py)
// fast computation of [lambda]P in projective coordinates
let point_mul_lambda (p:S.proj_point) : S.proj_point =
let (_X, _Y, _Z) = p in (S.(beta *% _X), _Y, _Z)
(**
Representing a scalar k as (r1 + r2 * lambda) mod S.q,
s.t. r1 and r2 are ~128 bits long
*)
let a1 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15
let minus_b1 : S.qelem = 0xe4437ed6010e88286f547fa90abfe4c3
let a2 : S.qelem = 0x114ca50f7a8e2f3f657c1108d9d44cfd8
let b2 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15
let minus_lambda : S.qelem =
let x = 0xac9c52b33fa3cf1f5ad9e3fd77ed9ba4a880b9fc8ec739c2e0cfc810b51283cf in
assert_norm (x = (- lambda) % S.q);
x
let b1 : S.qelem =
let x = 0xfffffffffffffffffffffffffffffffdd66b5e10ae3a1813507ddee3c5765c7e in
assert_norm (x = (- minus_b1) % S.q);
x
let minus_b2 : S.qelem =
let x = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE8A280AC50774346DD765CDA83DB1562C in
assert_norm (x = (- b2) % S.q);
x
let g1 : S.qelem =
let x = 0x3086D221A7D46BCDE86C90E49284EB153DAA8A1471E8CA7FE893209A45DBB031 in
assert_norm (pow2 384 * b2 / S.q + 1 = x);
x
let g2 : S.qelem =
let x = 0xE4437ED6010E88286F547FA90ABFE4C4221208AC9DF506C61571B4AE8AC47F71 in
assert_norm (pow2 384 * minus_b1 / S.q = x);
x
let qmul_shift_384 a b =
a * b / pow2 384 + (a * b / pow2 383 % 2) | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.GLV.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Spec.K256.PointOps.qelem -> b: Spec.K256.PointOps.qelem
-> FStar.Pervasives.Lemma (ensures Hacl.Spec.K256.GLV.qmul_shift_384 a b < Spec.K256.PointOps.q) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Spec.K256.PointOps.qelem",
"FStar.Pervasives.assert_norm",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.pow2",
"Spec.K256.PointOps.q",
"Prims.unit",
"Prims._assert",
"Prims.op_Division",
"FStar.Mul.op_Star",
"FStar.Math.Lemmas.lemma_div_lt_nat",
"FStar.Math.Lemmas.pow2_plus",
"FStar.Math.Lemmas.lemma_mult_lt_sqr"
] | [] | true | false | true | false | false | let qmul_shift_384_lemma a b =
| assert_norm (S.q < pow2 256);
Math.Lemmas.lemma_mult_lt_sqr a b (pow2 256);
Math.Lemmas.pow2_plus 256 256;
assert (a * b < pow2 512);
Math.Lemmas.lemma_div_lt_nat (a * b) 512 384;
assert (a * b / pow2 384 < pow2 128);
assert_norm (pow2 128 < S.q) | false |
Hacl.Spec.K256.GLV.fst | Hacl.Spec.K256.GLV.b2 | val b2:S.qelem | val b2:S.qelem | let b2 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15 | {
"file_name": "code/k256/Hacl.Spec.K256.GLV.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 53,
"end_line": 69,
"start_col": 0,
"start_line": 69
} | module Hacl.Spec.K256.GLV
open FStar.Mul
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
(**
This module implements the following two functions from libsecp256k1:
secp256k1_scalar_split_lambda [1] and secp256k1_ecmult_endo_split [2].
For the secp256k1 curve, we can replace the EC scalar multiplication
by `lambda` with one modular multiplication by `beta`:
[lambda](px, py) = (beta *% px, py) for any point on the curve P = (px, py),
where `lambda` and `beta` are primitive cube roots of unity and can be
fixed for the curve.
The main idea is to slit a 256-bit scalar k into k1 and k2 s.t.
k = (k1 + lambda * k2) % q, where k1 and k2 are 128-bit numbers:
[k]P = [(k1 + lambda * k2) % q]P = [k1]P + [k2]([lambda]P)
= [k1](px, py) + [k2](beta *% px, py).
Using a double fixed-window method, we can save 128 point_double:
| before | after
----------------------------------------------------------------------
point_double | 256 | 128
point_add | 256 / 5 = 51 | 128 / 5 + 128 / 5 + 1 = 25 + 25 + 1 = 51
Note that one precomputed table is enough for [k]P, as [r_small]([lambda]P)
can be obtained via [r_small]P.
[1]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/scalar_impl.h#L123
[2]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/ecmult_impl.h#L618
*)
(**
Fast computation of [lambda]P as (beta * x, y) in affine and projective coordinates
*)
let lambda : S.qelem = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72
let beta : S.felem = 0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee
// [a]P in affine coordinates
let aff_point_mul = S.aff_point_mul
// fast computation of [lambda]P in affine coordinates
let aff_point_mul_lambda (p:S.aff_point) : S.aff_point =
let (px, py) = p in (S.(beta *% px), py)
// fast computation of [lambda]P in projective coordinates
let point_mul_lambda (p:S.proj_point) : S.proj_point =
let (_X, _Y, _Z) = p in (S.(beta *% _X), _Y, _Z)
(**
Representing a scalar k as (r1 + r2 * lambda) mod S.q,
s.t. r1 and r2 are ~128 bits long
*)
let a1 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15
let minus_b1 : S.qelem = 0xe4437ed6010e88286f547fa90abfe4c3 | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.GLV.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Spec.K256.PointOps.qelem | Prims.Tot | [
"total"
] | [] | [] | [] | false | false | false | true | false | let b2:S.qelem =
| 0x3086d221a7d46bcde86c90e49284eb15 | false |
Hacl.Spec.K256.GLV.fst | Hacl.Spec.K256.GLV.qmul_shift_384 | val qmul_shift_384 : a: Prims.int -> b: Prims.int -> Prims.int | let qmul_shift_384 a b =
a * b / pow2 384 + (a * b / pow2 383 % 2) | {
"file_name": "code/k256/Hacl.Spec.K256.GLV.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 43,
"end_line": 97,
"start_col": 0,
"start_line": 96
} | module Hacl.Spec.K256.GLV
open FStar.Mul
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
(**
This module implements the following two functions from libsecp256k1:
secp256k1_scalar_split_lambda [1] and secp256k1_ecmult_endo_split [2].
For the secp256k1 curve, we can replace the EC scalar multiplication
by `lambda` with one modular multiplication by `beta`:
[lambda](px, py) = (beta *% px, py) for any point on the curve P = (px, py),
where `lambda` and `beta` are primitive cube roots of unity and can be
fixed for the curve.
The main idea is to slit a 256-bit scalar k into k1 and k2 s.t.
k = (k1 + lambda * k2) % q, where k1 and k2 are 128-bit numbers:
[k]P = [(k1 + lambda * k2) % q]P = [k1]P + [k2]([lambda]P)
= [k1](px, py) + [k2](beta *% px, py).
Using a double fixed-window method, we can save 128 point_double:
| before | after
----------------------------------------------------------------------
point_double | 256 | 128
point_add | 256 / 5 = 51 | 128 / 5 + 128 / 5 + 1 = 25 + 25 + 1 = 51
Note that one precomputed table is enough for [k]P, as [r_small]([lambda]P)
can be obtained via [r_small]P.
[1]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/scalar_impl.h#L123
[2]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/ecmult_impl.h#L618
*)
(**
Fast computation of [lambda]P as (beta * x, y) in affine and projective coordinates
*)
let lambda : S.qelem = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72
let beta : S.felem = 0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee
// [a]P in affine coordinates
let aff_point_mul = S.aff_point_mul
// fast computation of [lambda]P in affine coordinates
let aff_point_mul_lambda (p:S.aff_point) : S.aff_point =
let (px, py) = p in (S.(beta *% px), py)
// fast computation of [lambda]P in projective coordinates
let point_mul_lambda (p:S.proj_point) : S.proj_point =
let (_X, _Y, _Z) = p in (S.(beta *% _X), _Y, _Z)
(**
Representing a scalar k as (r1 + r2 * lambda) mod S.q,
s.t. r1 and r2 are ~128 bits long
*)
let a1 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15
let minus_b1 : S.qelem = 0xe4437ed6010e88286f547fa90abfe4c3
let a2 : S.qelem = 0x114ca50f7a8e2f3f657c1108d9d44cfd8
let b2 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15
let minus_lambda : S.qelem =
let x = 0xac9c52b33fa3cf1f5ad9e3fd77ed9ba4a880b9fc8ec739c2e0cfc810b51283cf in
assert_norm (x = (- lambda) % S.q);
x
let b1 : S.qelem =
let x = 0xfffffffffffffffffffffffffffffffdd66b5e10ae3a1813507ddee3c5765c7e in
assert_norm (x = (- minus_b1) % S.q);
x
let minus_b2 : S.qelem =
let x = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE8A280AC50774346DD765CDA83DB1562C in
assert_norm (x = (- b2) % S.q);
x
let g1 : S.qelem =
let x = 0x3086D221A7D46BCDE86C90E49284EB153DAA8A1471E8CA7FE893209A45DBB031 in
assert_norm (pow2 384 * b2 / S.q + 1 = x);
x
let g2 : S.qelem =
let x = 0xE4437ED6010E88286F547FA90ABFE4C4221208AC9DF506C61571B4AE8AC47F71 in
assert_norm (pow2 384 * minus_b1 / S.q = x);
x | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.GLV.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Prims.int -> b: Prims.int -> Prims.int | Prims.Tot | [
"total"
] | [] | [
"Prims.int",
"Prims.op_Addition",
"Prims.op_Division",
"FStar.Mul.op_Star",
"Prims.pow2",
"Prims.op_Modulus"
] | [] | false | false | false | true | false | let qmul_shift_384 a b =
| a * b / pow2 384 + (a * b / pow2 383 % 2) | false |
|
Hacl.Spec.K256.GLV.fst | Hacl.Spec.K256.GLV.scalar_split_lambda | val scalar_split_lambda (k: S.qelem) : S.qelem & S.qelem | val scalar_split_lambda (k: S.qelem) : S.qelem & S.qelem | let scalar_split_lambda (k:S.qelem) : S.qelem & S.qelem =
qmul_shift_384_lemma k g1;
qmul_shift_384_lemma k g2;
let c1 : S.qelem = qmul_shift_384 k g1 in
let c2 : S.qelem = qmul_shift_384 k g2 in
let c1 = S.(c1 *^ minus_b1) in
let c2 = S.(c2 *^ minus_b2) in
let r2 = S.(c1 +^ c2) in
let r1 = S.(k +^ r2 *^ minus_lambda) in
r1, r2 | {
"file_name": "code/k256/Hacl.Spec.K256.GLV.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 8,
"end_line": 121,
"start_col": 0,
"start_line": 110
} | module Hacl.Spec.K256.GLV
open FStar.Mul
module S = Spec.K256
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
(**
This module implements the following two functions from libsecp256k1:
secp256k1_scalar_split_lambda [1] and secp256k1_ecmult_endo_split [2].
For the secp256k1 curve, we can replace the EC scalar multiplication
by `lambda` with one modular multiplication by `beta`:
[lambda](px, py) = (beta *% px, py) for any point on the curve P = (px, py),
where `lambda` and `beta` are primitive cube roots of unity and can be
fixed for the curve.
The main idea is to slit a 256-bit scalar k into k1 and k2 s.t.
k = (k1 + lambda * k2) % q, where k1 and k2 are 128-bit numbers:
[k]P = [(k1 + lambda * k2) % q]P = [k1]P + [k2]([lambda]P)
= [k1](px, py) + [k2](beta *% px, py).
Using a double fixed-window method, we can save 128 point_double:
| before | after
----------------------------------------------------------------------
point_double | 256 | 128
point_add | 256 / 5 = 51 | 128 / 5 + 128 / 5 + 1 = 25 + 25 + 1 = 51
Note that one precomputed table is enough for [k]P, as [r_small]([lambda]P)
can be obtained via [r_small]P.
[1]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/scalar_impl.h#L123
[2]https://github.com/bitcoin-core/secp256k1/blob/a43e982bca580f4fba19d7ffaf9b5ee3f51641cb/src/ecmult_impl.h#L618
*)
(**
Fast computation of [lambda]P as (beta * x, y) in affine and projective coordinates
*)
let lambda : S.qelem = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72
let beta : S.felem = 0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee
// [a]P in affine coordinates
let aff_point_mul = S.aff_point_mul
// fast computation of [lambda]P in affine coordinates
let aff_point_mul_lambda (p:S.aff_point) : S.aff_point =
let (px, py) = p in (S.(beta *% px), py)
// fast computation of [lambda]P in projective coordinates
let point_mul_lambda (p:S.proj_point) : S.proj_point =
let (_X, _Y, _Z) = p in (S.(beta *% _X), _Y, _Z)
(**
Representing a scalar k as (r1 + r2 * lambda) mod S.q,
s.t. r1 and r2 are ~128 bits long
*)
let a1 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15
let minus_b1 : S.qelem = 0xe4437ed6010e88286f547fa90abfe4c3
let a2 : S.qelem = 0x114ca50f7a8e2f3f657c1108d9d44cfd8
let b2 : S.qelem = 0x3086d221a7d46bcde86c90e49284eb15
let minus_lambda : S.qelem =
let x = 0xac9c52b33fa3cf1f5ad9e3fd77ed9ba4a880b9fc8ec739c2e0cfc810b51283cf in
assert_norm (x = (- lambda) % S.q);
x
let b1 : S.qelem =
let x = 0xfffffffffffffffffffffffffffffffdd66b5e10ae3a1813507ddee3c5765c7e in
assert_norm (x = (- minus_b1) % S.q);
x
let minus_b2 : S.qelem =
let x = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE8A280AC50774346DD765CDA83DB1562C in
assert_norm (x = (- b2) % S.q);
x
let g1 : S.qelem =
let x = 0x3086D221A7D46BCDE86C90E49284EB153DAA8A1471E8CA7FE893209A45DBB031 in
assert_norm (pow2 384 * b2 / S.q + 1 = x);
x
let g2 : S.qelem =
let x = 0xE4437ED6010E88286F547FA90ABFE4C4221208AC9DF506C61571B4AE8AC47F71 in
assert_norm (pow2 384 * minus_b1 / S.q = x);
x
let qmul_shift_384 a b =
a * b / pow2 384 + (a * b / pow2 383 % 2)
val qmul_shift_384_lemma (a b:S.qelem) : Lemma (qmul_shift_384 a b < S.q)
let qmul_shift_384_lemma a b =
assert_norm (S.q < pow2 256);
Math.Lemmas.lemma_mult_lt_sqr a b (pow2 256);
Math.Lemmas.pow2_plus 256 256;
assert (a * b < pow2 512);
Math.Lemmas.lemma_div_lt_nat (a * b) 512 384;
assert (a * b / pow2 384 < pow2 128);
assert_norm (pow2 128 < S.q) | {
"checked_file": "/",
"dependencies": [
"Spec.K256.fst.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.K256.GLV.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.K256",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.K256",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | k: Spec.K256.PointOps.qelem -> Spec.K256.PointOps.qelem * Spec.K256.PointOps.qelem | Prims.Tot | [
"total"
] | [] | [
"Spec.K256.PointOps.qelem",
"FStar.Pervasives.Native.Mktuple2",
"Spec.K256.PointOps.op_Plus_Hat",
"Spec.K256.PointOps.op_Star_Hat",
"Hacl.Spec.K256.GLV.minus_lambda",
"Hacl.Spec.K256.GLV.minus_b2",
"Hacl.Spec.K256.GLV.minus_b1",
"Hacl.Spec.K256.GLV.qmul_shift_384",
"Hacl.Spec.K256.GLV.g2",
"Hacl.Spec.K256.GLV.g1",
"Prims.unit",
"Hacl.Spec.K256.GLV.qmul_shift_384_lemma",
"FStar.Pervasives.Native.tuple2"
] | [] | false | false | false | true | false | let scalar_split_lambda (k: S.qelem) : S.qelem & S.qelem =
| qmul_shift_384_lemma k g1;
qmul_shift_384_lemma k g2;
let c1:S.qelem = qmul_shift_384 k g1 in
let c2:S.qelem = qmul_shift_384 k g2 in
let c1 = let open S in c1 *^ minus_b1 in
let c2 = let open S in c2 *^ minus_b2 in
let r2 = let open S in c1 +^ c2 in
let r1 = let open S in k +^ r2 *^ minus_lambda in
r1, r2 | false |
Steel.ST.GenElim1.fst | Steel.ST.GenElim1.compute_gen_elim_nondep_correct11 | val compute_gen_elim_nondep_correct11 (i0: gen_elim_i) (t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11]) | val compute_gen_elim_nondep_correct11 (i0: gen_elim_i) (t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11]) | let compute_gen_elim_nondep_correct11
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> exists_ (fun x8 -> exists_ (fun x9 -> exists_ (fun x10 -> exists_ (fun x11 -> q x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 (U.raise_val ()))))))))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let x7 = elim_exists' () in
let x8 = elim_exists' () in
let x9 = elim_exists' () in
let x10 = elim_exists' () in
let x11 = elim_exists' () in
let res = Mktuple11 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res | {
"file_name": "lib/steel/Steel.ST.GenElim1.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 7,
"end_line": 682,
"start_col": 0,
"start_line": 661
} | module Steel.ST.GenElim1
let gen_elim_f
(p: vprop)
(a: Type)
(q: (a -> vprop))
(post: (a -> prop))
: Tot Type
= ((opened: inames) -> STGhost a opened p q True post)
module U = FStar.Universe
let gen_unit_elim_t (i: gen_unit_elim_i) : Tot Type =
gen_elim_f (compute_gen_unit_elim_p i) (U.raise_t u#_ u#1 unit) (fun _ -> compute_gen_unit_elim_q i) (fun _ -> compute_gen_unit_elim_post i)
let compute_gen_unit_elim_f_id
(v: vprop)
: Tot (gen_unit_elim_t (GUEId v))
= fun _ -> noop (); U.raise_val ()
let compute_gen_unit_elim_f_pure
(p: prop)
: Tot (gen_unit_elim_t (GUEPure p))
= fun _ ->
rewrite (compute_gen_unit_elim_p (GUEPure p)) (pure p);
elim_pure p;
U.raise_val ()
let compute_gen_unit_elim_f_star
(i1 i2: gen_unit_elim_i)
(f1: gen_unit_elim_t i1)
(f2: gen_unit_elim_t i2)
: Tot (gen_unit_elim_t (GUEStar i1 i2))
= fun _ ->
rewrite (compute_gen_unit_elim_p (GUEStar i1 i2)) (compute_gen_unit_elim_p i1 `star` compute_gen_unit_elim_p i2);
let _ = f1 _ in
let _ = f2 _ in
rewrite (compute_gen_unit_elim_q i1 `star` compute_gen_unit_elim_q i2) (compute_gen_unit_elim_q (GUEStar i1 i2));
U.raise_val ()
let rec compute_gen_unit_elim_f
(i: gen_unit_elim_i)
: GTot (gen_unit_elim_t i)
= match i returns (gen_unit_elim_t i) with
| GUEId v -> compute_gen_unit_elim_f_id v
| GUEPure p -> compute_gen_unit_elim_f_pure p
| GUEStar i1 i2 -> compute_gen_unit_elim_f_star i1 i2 (compute_gen_unit_elim_f i1) (compute_gen_unit_elim_f i2)
let gen_elim_t (i: gen_elim_i) : Tot Type =
gen_elim_f (compute_gen_elim_p i) (compute_gen_elim_a i) (compute_gen_elim_q i) (compute_gen_elim_post i)
let compute_gen_elim_f_unit
(i: gen_unit_elim_i)
: GTot (gen_elim_t (GEUnit i))
= compute_gen_unit_elim_f i
let compute_gen_elim_f_star_l
(i1: gen_elim_i)
(f1: gen_elim_t i1)
(i2: gen_unit_elim_i)
: GTot (gen_elim_t (GEStarL i1 i2))
= let f2 = compute_gen_unit_elim_f i2 in
fun _ ->
rewrite (compute_gen_elim_p (GEStarL i1 i2)) (compute_gen_elim_p i1 `star` compute_gen_unit_elim_p i2);
let res = f1 _ in
let _ = f2 _ in
let res' : compute_gen_elim_a (GEStarL i1 i2) = coerce_with_trefl res in
rewrite (compute_gen_elim_q i1 res `star` compute_gen_unit_elim_q i2) (compute_gen_elim_q (GEStarL i1 i2) res');
res'
let compute_gen_elim_f_star_r
(i1: gen_unit_elim_i)
(i2: gen_elim_i)
(f2: gen_elim_t i2)
: GTot (gen_elim_t (GEStarR i1 i2))
= let f1 = compute_gen_unit_elim_f i1 in
fun _ ->
rewrite (compute_gen_elim_p (GEStarR i1 i2)) (compute_gen_unit_elim_p i1 `star` compute_gen_elim_p i2);
let _ = f1 _ in
let res = f2 _ in
let res' : compute_gen_elim_a (GEStarR i1 i2) = coerce_with_trefl res in
rewrite (compute_gen_unit_elim_q i1 `star` compute_gen_elim_q i2 res) (compute_gen_elim_q (GEStarR i1 i2) res');
res'
let compute_gen_elim_f_star
(i1: gen_elim_i)
(f1: gen_elim_t i1)
(i2: gen_elim_i)
(f2: gen_elim_t i2)
: GTot (gen_elim_t (GEStar i1 i2))
= fun _ ->
rewrite (compute_gen_elim_p (GEStar i1 i2)) (compute_gen_elim_p i1 `star` compute_gen_elim_p i2);
let res1 = f1 _ in
let res2 = f2 _ in
let res : compute_gen_elim_a (GEStar i1 i2) = coerce_with_trefl (res1, res2) in
rewrite (compute_gen_elim_q i1 res1 `star` compute_gen_elim_q i2 res2) (compute_gen_elim_q (GEStar i1 i2) res);
res
let compute_gen_elim_f_exists_no_abs0
(a: Type0)
(body: (a -> vprop))
: GTot (gen_elim_t (GEExistsNoAbs0 body))
= fun _ ->
rewrite (compute_gen_elim_p (GEExistsNoAbs0 body)) (exists_ body);
let gres = elim_exists () in
let res : compute_gen_elim_a (GEExistsNoAbs0 body) = U.raise_val (Ghost.reveal gres) in // coerce_with_trefl (Ghost.reveal gres) in
rewrite (body gres) (compute_gen_elim_q (GEExistsNoAbs0 body) res);
res
let rewrite_with_trefl (#opened:_) (p q:vprop)
: STGhost unit opened
p
(fun _ -> q)
(requires T.with_tactic T.trefl (p == q))
(ensures fun _ -> True)
= rewrite p q
let compute_gen_elim_f_exists_unit0
(a: Type0)
(body: a -> gen_unit_elim_i)
: Tot (gen_elim_t (GEExistsUnit0 body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p (GEExistsUnit0 body)) (exists_ (fun x -> compute_gen_unit_elim_p (body x)));
let gres = elim_exists () in
let _ = compute_gen_unit_elim_f (body gres) _ in
let res : compute_gen_elim_a (GEExistsUnit0 body) = U.raise_val (Ghost.reveal gres) in // coerce_with_trefl (Ghost.reveal gres) in
rewrite (compute_gen_unit_elim_q (body gres)) (compute_gen_elim_q (GEExistsUnit0 body) res);
res
let compute_gen_elim_f_exists0
(a: Type0)
(body: a -> gen_elim_i)
(f: (x: a) -> GTot (gen_elim_t (body x)))
: Tot (gen_elim_t (GEExists0 body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p (GEExists0 body)) (exists_ (fun x -> compute_gen_elim_p (body x)));
let gres1 = elim_exists () in
let gres2 = f gres1 _ in
let res : compute_gen_elim_a (GEExists0 body) = coerce_with_trefl (Mkdtuple2 #a #(fun x -> compute_gen_elim_a (body x)) (Ghost.reveal gres1) (Ghost.reveal gres2)) in
rewrite (compute_gen_elim_q (body gres1) gres2) (compute_gen_elim_q (GEExists0 body) res);
res
let compute_gen_elim_f_exists_no_abs1
(a: Type)
(body: (a -> vprop))
: GTot (gen_elim_t (GEExistsNoAbs1 body))
= fun _ ->
rewrite (compute_gen_elim_p (GEExistsNoAbs1 body)) (exists_ body);
let gres = elim_exists () in
let res : compute_gen_elim_a (GEExistsNoAbs1 body) = coerce_with_trefl (Ghost.reveal gres) in
rewrite (body gres) (compute_gen_elim_q (GEExistsNoAbs1 body) res);
res
let compute_gen_elim_f_exists_unit1
(a: Type)
(body: a -> gen_unit_elim_i)
: Tot (gen_elim_t (GEExistsUnit1 body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p (GEExistsUnit1 body)) (exists_ (fun x -> compute_gen_unit_elim_p (body x)));
let gres = elim_exists () in
let _ = compute_gen_unit_elim_f (body gres) _ in
let res : compute_gen_elim_a (GEExistsUnit1 body) = coerce_with_trefl (Ghost.reveal gres) in
rewrite (compute_gen_unit_elim_q (body gres)) (compute_gen_elim_q (GEExistsUnit1 body) res);
res
let compute_gen_elim_f_exists1
(a: Type)
(body: a -> gen_elim_i)
(f: (x: a) -> GTot (gen_elim_t (body x)))
: Tot (gen_elim_t (GEExists1 body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p (GEExists1 body)) (exists_ (fun x -> compute_gen_elim_p (body x)));
let gres1 = elim_exists () in
let gres2 = f gres1 _ in
let res : compute_gen_elim_a (GEExists1 body) = coerce_with_trefl (Mkdtuple2 #a #(fun x -> compute_gen_elim_a (body x)) (Ghost.reveal gres1) (Ghost.reveal gres2)) in
rewrite (compute_gen_elim_q (body gres1) gres2) (compute_gen_elim_q (GEExists1 body) res);
res
let rec compute_gen_elim_f
(i: gen_elim_i)
: GTot (gen_elim_t i)
= match i returns (gen_elim_t i) with
| GEUnit i -> compute_gen_elim_f_unit i
| GEStarL i1 i2 -> compute_gen_elim_f_star_l i1 (compute_gen_elim_f i1) i2
| GEStarR i1 i2 -> compute_gen_elim_f_star_r i1 i2 (compute_gen_elim_f i2)
| GEStar i1 i2 -> compute_gen_elim_f_star i1 (compute_gen_elim_f i1) i2 (compute_gen_elim_f i2)
| GEExistsNoAbs0 body -> compute_gen_elim_f_exists_no_abs0 _ body
| GEExistsUnit0 body -> compute_gen_elim_f_exists_unit0 _ body
| GEExists0 body -> compute_gen_elim_f_exists0 _ body (fun x -> compute_gen_elim_f (body x))
| GEExistsNoAbs1 body -> compute_gen_elim_f_exists_no_abs1 _ body
| GEExistsUnit1 body -> compute_gen_elim_f_exists_unit1 _ body
| GEExists1 body -> compute_gen_elim_f_exists1 _ body (fun x -> compute_gen_elim_f (body x))
let rec tele_p (x: gen_elim_tele) : Tot vprop =
match x with
| TRet v p -> v `star` pure p
| TExists ty body -> exists_ (fun x -> tele_p (body x))
let elim_exists' (#a:Type)
(#opened_invariants:_)
(#p:a -> vprop)
(_:unit)
: STGhostT (a) opened_invariants
(exists_ p)
(fun x -> p x)
= let gx = elim_exists () in
let x = Ghost.reveal gx in
rewrite (p gx) (p x);
x
let vprop_rewrite (from to: vprop) : Tot Type =
gen_elim_f from unit (fun _ -> to) (fun _ -> True)
let tele_star_vprop_correct_ret
(v': vprop) (p': prop) (v: vprop) (p: prop)
: Tot (vprop_rewrite (tele_p (TRet v' p') `star` v `star` pure p) (tele_p (tele_star_vprop (TRet v' p') v p)))
= fun _ ->
elim_pure p;
rewrite (tele_p _) (v' `star` pure p');
elim_pure p';
intro_pure (p /\ p');
rewrite ((v `star` v') `star` pure (p /\ p')) (tele_p _)
let tele_star_vprop_correct_exists
(v: vprop) (p: prop)
(ty: _) (body: ty -> gen_elim_tele) (ih: (x: ty) -> GTot (vprop_rewrite (tele_p (body x) `star` v `star` pure p) (tele_p (tele_star_vprop (body x) v p))))
: Tot (vprop_rewrite (tele_p (TExists ty body) `star` v `star` pure p) (tele_p (tele_star_vprop (TExists ty body) v p)))
= fun _ ->
rewrite_with_trefl (tele_p _) (exists_ (fun x -> tele_p (body x)));
let x = elim_exists' () in
ih x _;
intro_exists x (fun x -> tele_p (tele_star_vprop (body x) v p));
rewrite_with_trefl (exists_ (fun x -> tele_p (tele_star_vprop (body x) v p))) (tele_p _)
let rec tele_star_vprop_correct
(i: gen_elim_tele) (v: vprop) (p: prop)
: GTot (vprop_rewrite
(tele_p i `star` v `star` pure p)
(tele_p (tele_star_vprop i v p))
)
= match i returns vprop_rewrite
(tele_p i `star` v `star` pure p)
(tele_p (tele_star_vprop i v p)) with
| TRet v' p' -> tele_star_vprop_correct_ret v' p' v p
| TExists ty body -> tele_star_vprop_correct_exists v p ty body (fun x -> tele_star_vprop_correct (body x) v p)
let tele_star_correct_ret_l
(v1: vprop) (p1: prop) (i2: gen_elim_tele)
: Tot (vprop_rewrite (tele_p (TRet v1 p1) `star` tele_p i2) (tele_p (TRet v1 p1 `tele_star` i2)))
= fun _ ->
rewrite (tele_p (TRet v1 p1)) (v1 `star` pure p1);
tele_star_vprop_correct i2 v1 p1 _;
rewrite (tele_p _) (tele_p _)
let tele_star_correct_ret_r
(i1: gen_elim_tele { ~ (TRet? i1) }) (v2: vprop) (p2: prop)
: Tot (vprop_rewrite (tele_p i1 `star` tele_p (TRet v2 p2)) (tele_p (i1 `tele_star` TRet v2 p2)))
= fun _ ->
rewrite (tele_p (TRet v2 p2)) (v2 `star` pure p2);
tele_star_vprop_correct i1 v2 p2 _;
rewrite (tele_p _) (tele_p (i1 `tele_star` TRet v2 p2))
let tele_star_correct_exists
(ty1: _) (f1: ty1 -> gen_elim_tele) (ty2: _) (f2: ty2 -> gen_elim_tele)
(ih: (x1: ty1) -> (x2: ty2) -> GTot (vprop_rewrite (tele_p (f1 x1) `star` tele_p (f2 x2)) (tele_p (f1 x1 `tele_star` f2 x2))))
: Tot (vprop_rewrite (tele_p (TExists ty1 f1) `star` tele_p (TExists ty2 f2)) (tele_p (tele_star (TExists ty1 f1) (TExists ty2 f2))))
= fun _ ->
rewrite_with_trefl (tele_p (TExists ty1 f1)) (exists_ (fun x1 -> tele_p (f1 x1)));
let x1 = elim_exists' () in
rewrite_with_trefl (tele_p (TExists ty2 f2)) (exists_ (fun x2 -> tele_p (f2 x2)));
let x2 = elim_exists' () in
ih x1 x2 _;
intro_exists x2 (fun x2 -> tele_p (tele_star (f1 x1) (f2 x2)));
intro_exists x1 (fun x1 -> exists_ (fun x2 -> tele_p (tele_star (f1 x1) (f2 x2))));
rewrite_with_trefl (exists_ _) (tele_p _)
let rec tele_star_correct
(i1 i2: gen_elim_tele)
: GTot (vprop_rewrite (tele_p i1 `star` tele_p i2) (tele_p (i1 `tele_star` i2)))
= match i1 returns vprop_rewrite (tele_p i1 `star` tele_p i2) (tele_p (i1 `tele_star` i2)) with
| TRet v1 p1 -> tele_star_correct_ret_l v1 p1 i2
| TExists ty1 f1 ->
begin match i2 returns vprop_rewrite (tele_p (TExists ty1 f1) `star` tele_p i2) (tele_p (TExists ty1 f1 `tele_star` i2)) with
| TRet v2 p2 -> tele_star_correct_ret_r (TExists ty1 f1) v2 p2
| TExists ty2 f2 -> tele_star_correct_exists ty1 f1 ty2 f2 (fun x1 x2 -> tele_star_correct (f1 x1) (f2 x2))
end
[@@noextract_to "Plugin" ]
let ge_to_tele_t
(i: gen_elim_i)
: Tot Type
= vprop_rewrite (compute_gen_elim_p i) (tele_p (compute_gen_elim_tele i))
let compute_gen_elim_tele_correct_unit
(v: gen_unit_elim_i)
: Tot (ge_to_tele_t (GEUnit v))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (compute_gen_unit_elim_p v);
let _ = compute_gen_unit_elim_f v _ in
intro_pure (compute_gen_unit_elim_post v);
rewrite_with_trefl (compute_gen_unit_elim_q v `star` pure _) (tele_p _)
let compute_gen_elim_tele_correct_star_l
(l: gen_elim_i)
(ihl: ge_to_tele_t l)
(ru: gen_unit_elim_i)
: Tot (ge_to_tele_t (GEStarL l ru))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (compute_gen_elim_p l `star` compute_gen_unit_elim_p ru);
ihl _;
let _ = compute_gen_unit_elim_f ru _ in
intro_pure (compute_gen_unit_elim_post ru);
tele_star_vprop_correct _ _ _ _;
rewrite_with_trefl (tele_p _) (tele_p _)
let compute_gen_elim_tele_correct_star_r
(lu: gen_unit_elim_i)
(r: gen_elim_i)
(ihr: ge_to_tele_t r)
: Tot (ge_to_tele_t (GEStarR lu r))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (compute_gen_unit_elim_p lu `star` compute_gen_elim_p r);
ihr _;
let _ = compute_gen_unit_elim_f lu _ in
intro_pure (compute_gen_unit_elim_post lu);
tele_star_vprop_correct _ _ _ _;
rewrite_with_trefl (tele_p _) (tele_p _)
let compute_gen_elim_tele_correct_star
(l: gen_elim_i)
(ihl: ge_to_tele_t l)
(r: gen_elim_i)
(ihr: ge_to_tele_t r)
: Tot (ge_to_tele_t (GEStar l r))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (compute_gen_elim_p l `star` compute_gen_elim_p r);
ihl _;
ihr _;
tele_star_correct (compute_gen_elim_tele l) (compute_gen_elim_tele r) _;
rewrite_with_trefl (tele_p _) (tele_p _)
let compute_gen_elim_tele_correct_exists_no_abs0
(ty: _)
(body: ty -> vprop)
: Tot (ge_to_tele_t (GEExistsNoAbs0 #ty body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (exists_ body);
let x = elim_exists' () in
intro_pure True;
rewrite (body x) (body (U.downgrade_val (U.raise_val x)));
intro_exists (U.raise_val u#0 u#1 x) (fun x -> body (U.downgrade_val x) `star` pure True);
rewrite_with_trefl (exists_ _) (tele_p _)
let compute_gen_elim_tele_correct_exists_unit0
(ty: _)
(body: ty -> gen_unit_elim_i)
: Tot (ge_to_tele_t (GEExistsUnit0 #ty body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (exists_ (fun x -> compute_gen_unit_elim_p (body x)));
let x = elim_exists' () in
let _ = compute_gen_unit_elim_f (body x) _ in
intro_pure (compute_gen_unit_elim_post (body (U.downgrade_val (U.raise_val u#0 u#1 x))));
rewrite (compute_gen_unit_elim_q (body x)) (compute_gen_unit_elim_q (body (U.downgrade_val (U.raise_val x))));
intro_exists (U.raise_val u#0 u#1 x) (fun x -> compute_gen_unit_elim_q (body (U.downgrade_val x)) `star` pure (compute_gen_unit_elim_post (body (U.downgrade_val x))));
rewrite_with_trefl (exists_ _) (tele_p _)
let compute_gen_elim_tele_correct_exists0
(ty: _)
(body: ty -> gen_elim_i)
(ih: (x: ty) -> GTot (ge_to_tele_t (body x)))
: Tot (ge_to_tele_t (GEExists0 #ty body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (exists_ (fun x -> compute_gen_elim_p (body x)));
let x = elim_exists' () in
ih x _;
rewrite (tele_p (compute_gen_elim_tele (body x))) (tele_p (compute_gen_elim_tele (body (U.downgrade_val (U.raise_val u#0 u#1 x)))));
intro_exists (U.raise_val u#0 u#1 x) (fun x -> tele_p (compute_gen_elim_tele (body (U.downgrade_val u#0 u#1 x))));
rewrite_with_trefl (exists_ _) (tele_p _)
let compute_gen_elim_tele_correct_exists_no_abs1
(ty: _)
(body: ty -> vprop)
: Tot (ge_to_tele_t (GEExistsNoAbs1 #ty body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (exists_ body);
let x = elim_exists' () in
intro_pure True;
intro_exists x (fun x -> body x `star` pure True);
rewrite_with_trefl (exists_ _) (tele_p _)
let compute_gen_elim_tele_correct_exists_unit1
(ty: _)
(body: ty -> gen_unit_elim_i)
: Tot (ge_to_tele_t (GEExistsUnit1 #ty body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (exists_ (fun x -> compute_gen_unit_elim_p (body x)));
let x = elim_exists' () in
let _ = compute_gen_unit_elim_f (body x) _ in
intro_pure (compute_gen_unit_elim_post (body x));
intro_exists x (fun x -> compute_gen_unit_elim_q (body x) `star` pure (compute_gen_unit_elim_post (body x)));
rewrite_with_trefl (exists_ _) (tele_p _)
let compute_gen_elim_tele_correct_exists1
(ty: _)
(body: ty -> gen_elim_i)
(ih: (x: ty) -> GTot (ge_to_tele_t (body x)))
: Tot (ge_to_tele_t (GEExists1 #ty body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (exists_ (fun x -> compute_gen_elim_p (body x)));
let x = elim_exists' () in
ih x _;
intro_exists x (fun x -> tele_p (compute_gen_elim_tele (body x)));
rewrite_with_trefl (exists_ _) (tele_p _)
let rec compute_gen_elim_tele_correct
(x: gen_elim_i)
: GTot (ge_to_tele_t x)
= match x returns ge_to_tele_t x with
| GEUnit v -> compute_gen_elim_tele_correct_unit v
| GEStarL l ru -> compute_gen_elim_tele_correct_star_l l (compute_gen_elim_tele_correct l) ru
| GEStarR lu r -> compute_gen_elim_tele_correct_star_r lu r (compute_gen_elim_tele_correct r)
| GEStar l r -> compute_gen_elim_tele_correct_star l (compute_gen_elim_tele_correct l) r (compute_gen_elim_tele_correct r)
| GEExistsNoAbs0 #ty body -> compute_gen_elim_tele_correct_exists_no_abs0 ty body
| GEExistsUnit0 #ty body -> compute_gen_elim_tele_correct_exists_unit0 ty body
| GEExists0 #ty body -> compute_gen_elim_tele_correct_exists0 ty body (fun x -> compute_gen_elim_tele_correct (body x))
| GEExistsNoAbs1 #ty body -> compute_gen_elim_tele_correct_exists_no_abs1 ty body
| GEExistsUnit1 #ty body -> compute_gen_elim_tele_correct_exists_unit1 ty body
| GEExists1 #ty body -> compute_gen_elim_tele_correct_exists1 ty body (fun x -> compute_gen_elim_tele_correct (body x))
let rec gen_elim_nondep_p (ty: list (Type u#a)) : Tot (curried_function_type ty (U.raise_t u#_ u#(max 2 a) unit -> vprop) -> curried_function_type ty (U.raise_t u#_ u#(max 2 a) unit -> prop) -> Tot vprop) =
match ty as ty' returns curried_function_type ty' (U.raise_t u#_ u#(max 2 a) unit -> vprop) -> curried_function_type ty' (U.raise_t u#_ u#(max 2 a) unit -> prop) -> Tot vprop with
| [] -> fun q post -> q (U.raise_val ()) `star` pure (post (U.raise_val ()))
| t :: tq -> fun q post -> exists_ (fun x -> gen_elim_nondep_p tq (q x) (post x))
let rec gen_elim_nondep_sem_correct
(ty: list (Type u#a))
: Tot ((q: curried_function_type ty _) -> (post: curried_function_type ty _) -> Lemma
(tele_p (gen_elim_nondep_sem ty q post) `equiv` gen_elim_nondep_p ty q post)
)
= match ty returns ((q: curried_function_type ty _) -> (post: curried_function_type ty _) -> Lemma
(tele_p (gen_elim_nondep_sem ty q post) `equiv` gen_elim_nondep_p ty q post)
)
with
| [] -> fun q post -> equiv_refl (q (U.raise_val ()) `star` pure (post (U.raise_val ())))
| ta :: tq -> fun q post ->
let phi
(x: ta)
: Lemma
(tele_p (gen_elim_nondep_sem tq (q x) (post x)) `equiv` gen_elim_nondep_p tq (q x) (post x))
= gen_elim_nondep_sem_correct tq (q x) (post x)
in
Classical.forall_intro phi;
let prf () : Lemma
(exists_ (fun x -> tele_p (gen_elim_nondep_sem tq (q x) (post x))) `equiv` exists_ (fun x -> gen_elim_nondep_p tq (q x) (post x)))
=
exists_equiv (fun x -> tele_p (gen_elim_nondep_sem tq (q x) (post x))) (fun x -> gen_elim_nondep_p tq (q x) (post x))
in
assert_norm (tele_p (gen_elim_nondep_sem (ta :: tq) q post) == exists_ (fun x -> tele_p (gen_elim_nondep_sem tq (q x) (post x))));
assert_norm (gen_elim_nondep_p (ta :: tq) q post == exists_ (fun x -> gen_elim_nondep_p tq (q x) (post x)));
prf ()
let compute_gen_elim_nondep_correct_t
(i0: gen_elim_i)
(ty: list (Type u#1))
: Tot Type
= (q: _) ->
(post: _) ->
(intro: vprop_rewrite (compute_gen_elim_p i0) (gen_elim_nondep_p ty q post)) ->
GTot (gen_elim_f
(compute_gen_elim_p i0)
(compute_gen_elim_nondep_a' ty)
(fun x -> compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) ty q x (U.raise_val ()))
(fun x -> compute_uncurry _ (fun _ -> True) ty post x (U.raise_val ()))
)
let compute_gen_elim_nondep_correct0
(i0: gen_elim_i)
: Tot (compute_gen_elim_nondep_correct_t i0 [])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (q (U.raise_val ()) `star` pure (post (U.raise_val ())));
let res = U.raise_val () in
elim_pure _;
rewrite_with_trefl (q (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct1
(i0: gen_elim_i)
(t1: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> q x1 (U.raise_val ()) `star` pure (post x1 (U.raise_val ()))));
let res = elim_exists' () in
elim_pure _;
rewrite_with_trefl (q _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct2
(i0: gen_elim_i)
(t1 t2: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> q x1 x2 (U.raise_val ()) `star` pure (post x1 x2 (U.raise_val ())))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let res = Mktuple2 x1 x2 in
elim_pure _;
rewrite_with_trefl (q _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct3
(i0: gen_elim_i)
(t1 t2 t3: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> q x1 x2 x3 (U.raise_val ()) `star` pure (post x1 x2 x3 (U.raise_val ()))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let res = Mktuple3 x1 x2 x3 in
elim_pure _;
rewrite_with_trefl (q _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct4
(i0: gen_elim_i)
(t1 t2 t3 t4: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> q x1 x2 x3 x4 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 (U.raise_val ())))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let res = Mktuple4 x1 x2 x3 x4 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct5
(i0: gen_elim_i)
(t1 t2 t3 t4 t5: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> q x1 x2 x3 x4 x5 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 (U.raise_val ()))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let res = Mktuple5 x1 x2 x3 x4 x5 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct6
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> q x1 x2 x3 x4 x5 x6 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 (U.raise_val ())))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let res = Mktuple6 x1 x2 x3 x4 x5 x6 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct7
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> q x1 x2 x3 x4 x5 x6 x7 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 (U.raise_val ()))))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let x7 = elim_exists' () in
let res = Mktuple7 x1 x2 x3 x4 x5 x6 x7 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct8
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7 t8: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> exists_ (fun x8 -> q x1 x2 x3 x4 x5 x6 x7 x8 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 x8 (U.raise_val ())))))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let x7 = elim_exists' () in
let x8 = elim_exists' () in
let res = Mktuple8 x1 x2 x3 x4 x5 x6 x7 x8 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct9
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7 t8 t9: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> exists_ (fun x8 -> exists_ (fun x9 -> q x1 x2 x3 x4 x5 x6 x7 x8 x9 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 x8 x9 (U.raise_val ()))))))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let x7 = elim_exists' () in
let x8 = elim_exists' () in
let x9 = elim_exists' () in
let res = Mktuple9 x1 x2 x3 x4 x5 x6 x7 x8 x9 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct10
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7 t8 t9 t10: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> exists_ (fun x8 -> exists_ (fun x9 -> exists_ (fun x10 -> q x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 (U.raise_val ())))))))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let x7 = elim_exists' () in
let x8 = elim_exists' () in
let x9 = elim_exists' () in
let x10 = elim_exists' () in
let res = Mktuple10 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.GenElim1.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Universe",
"short_module": "U"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Steel.ST.GenElim1.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"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 |
i0: Steel.ST.GenElim1.Base.gen_elim_i ->
t1: Type ->
t2: Type ->
t3: Type ->
t4: Type ->
t5: Type ->
t6: Type ->
t7: Type ->
t8: Type ->
t9: Type ->
t10: Type ->
t11: Type
-> Steel.ST.GenElim1.compute_gen_elim_nondep_correct_t i0
[t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11] | Prims.Tot | [
"total"
] | [] | [
"Steel.ST.GenElim1.Base.gen_elim_i",
"Steel.ST.GenElim1.Base.curried_function_type",
"Prims.Cons",
"Prims.Nil",
"FStar.Universe.raise_t",
"Prims.unit",
"Steel.Effect.Common.vprop",
"Prims.prop",
"Steel.ST.GenElim1.vprop_rewrite",
"Steel.ST.GenElim1.Base.compute_gen_elim_p",
"Steel.ST.GenElim1.gen_elim_nondep_p",
"Steel.Memory.inames",
"Steel.ST.GenElim1.Base.compute_gen_elim_nondep_a'",
"Steel.ST.GenElim1.rewrite_with_trefl",
"FStar.Universe.raise_val",
"Steel.ST.GenElim1.Base.compute_uncurry",
"Steel.ST.GenElim1.Base.compute_gen_elim_p'",
"Steel.ST.Util.elim_pure",
"FStar.Pervasives.Native.tuple11",
"FStar.Pervasives.Native.Mktuple11",
"Steel.ST.GenElim1.elim_exists'",
"Steel.Effect.Common.VStar",
"Steel.ST.Util.pure",
"Steel.ST.Util.exists_",
"Steel.Effect.Common.star",
"Steel.ST.GenElim1.compute_gen_elim_nondep_correct_t"
] | [] | false | false | false | false | false | let compute_gen_elim_nondep_correct11 (i0: gen_elim_i) (t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11]) =
| fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _)
(exists_ (fun x1 ->
exists_ (fun x2 ->
exists_ (fun x3 ->
exists_ (fun x4 ->
exists_ (fun x5 ->
exists_ (fun x6 ->
exists_ (fun x7 ->
exists_ (fun x8 ->
exists_ (fun x9 ->
exists_ (fun x10 ->
exists_ (fun x11 ->
(q x1 x2 x3 x4 x5 x6 x7 x8
x9 x10 x11
(U.raise_val ()))
`star`
(pure (post x1 x2 x3 x4 x5
x6 x7 x8 x9 x10 x11
(U.raise_val ())))))
))))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let x7 = elim_exists' () in
let x8 = elim_exists' () in
let x9 = elim_exists' () in
let x10 = elim_exists' () in
let x11 = elim_exists' () in
let res = Mktuple11 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ _ _ _ _ _ (U.raise_val ()))
(compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res | false |
Steel.ST.GenElim1.fst | Steel.ST.GenElim1.compute_gen_elim_nondep_correct12 | val compute_gen_elim_nondep_correct12
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12]) | val compute_gen_elim_nondep_correct12
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12]) | let compute_gen_elim_nondep_correct12
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> exists_ (fun x8 -> exists_ (fun x9 -> exists_ (fun x10 -> exists_ (fun x11 -> exists_ (fun x12 -> q x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 (U.raise_val ())))))))))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let x7 = elim_exists' () in
let x8 = elim_exists' () in
let x9 = elim_exists' () in
let x10 = elim_exists' () in
let x11 = elim_exists' () in
let x12 = elim_exists' () in
let res = Mktuple12 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res | {
"file_name": "lib/steel/Steel.ST.GenElim1.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 7,
"end_line": 706,
"start_col": 0,
"start_line": 684
} | module Steel.ST.GenElim1
let gen_elim_f
(p: vprop)
(a: Type)
(q: (a -> vprop))
(post: (a -> prop))
: Tot Type
= ((opened: inames) -> STGhost a opened p q True post)
module U = FStar.Universe
let gen_unit_elim_t (i: gen_unit_elim_i) : Tot Type =
gen_elim_f (compute_gen_unit_elim_p i) (U.raise_t u#_ u#1 unit) (fun _ -> compute_gen_unit_elim_q i) (fun _ -> compute_gen_unit_elim_post i)
let compute_gen_unit_elim_f_id
(v: vprop)
: Tot (gen_unit_elim_t (GUEId v))
= fun _ -> noop (); U.raise_val ()
let compute_gen_unit_elim_f_pure
(p: prop)
: Tot (gen_unit_elim_t (GUEPure p))
= fun _ ->
rewrite (compute_gen_unit_elim_p (GUEPure p)) (pure p);
elim_pure p;
U.raise_val ()
let compute_gen_unit_elim_f_star
(i1 i2: gen_unit_elim_i)
(f1: gen_unit_elim_t i1)
(f2: gen_unit_elim_t i2)
: Tot (gen_unit_elim_t (GUEStar i1 i2))
= fun _ ->
rewrite (compute_gen_unit_elim_p (GUEStar i1 i2)) (compute_gen_unit_elim_p i1 `star` compute_gen_unit_elim_p i2);
let _ = f1 _ in
let _ = f2 _ in
rewrite (compute_gen_unit_elim_q i1 `star` compute_gen_unit_elim_q i2) (compute_gen_unit_elim_q (GUEStar i1 i2));
U.raise_val ()
let rec compute_gen_unit_elim_f
(i: gen_unit_elim_i)
: GTot (gen_unit_elim_t i)
= match i returns (gen_unit_elim_t i) with
| GUEId v -> compute_gen_unit_elim_f_id v
| GUEPure p -> compute_gen_unit_elim_f_pure p
| GUEStar i1 i2 -> compute_gen_unit_elim_f_star i1 i2 (compute_gen_unit_elim_f i1) (compute_gen_unit_elim_f i2)
let gen_elim_t (i: gen_elim_i) : Tot Type =
gen_elim_f (compute_gen_elim_p i) (compute_gen_elim_a i) (compute_gen_elim_q i) (compute_gen_elim_post i)
let compute_gen_elim_f_unit
(i: gen_unit_elim_i)
: GTot (gen_elim_t (GEUnit i))
= compute_gen_unit_elim_f i
let compute_gen_elim_f_star_l
(i1: gen_elim_i)
(f1: gen_elim_t i1)
(i2: gen_unit_elim_i)
: GTot (gen_elim_t (GEStarL i1 i2))
= let f2 = compute_gen_unit_elim_f i2 in
fun _ ->
rewrite (compute_gen_elim_p (GEStarL i1 i2)) (compute_gen_elim_p i1 `star` compute_gen_unit_elim_p i2);
let res = f1 _ in
let _ = f2 _ in
let res' : compute_gen_elim_a (GEStarL i1 i2) = coerce_with_trefl res in
rewrite (compute_gen_elim_q i1 res `star` compute_gen_unit_elim_q i2) (compute_gen_elim_q (GEStarL i1 i2) res');
res'
let compute_gen_elim_f_star_r
(i1: gen_unit_elim_i)
(i2: gen_elim_i)
(f2: gen_elim_t i2)
: GTot (gen_elim_t (GEStarR i1 i2))
= let f1 = compute_gen_unit_elim_f i1 in
fun _ ->
rewrite (compute_gen_elim_p (GEStarR i1 i2)) (compute_gen_unit_elim_p i1 `star` compute_gen_elim_p i2);
let _ = f1 _ in
let res = f2 _ in
let res' : compute_gen_elim_a (GEStarR i1 i2) = coerce_with_trefl res in
rewrite (compute_gen_unit_elim_q i1 `star` compute_gen_elim_q i2 res) (compute_gen_elim_q (GEStarR i1 i2) res');
res'
let compute_gen_elim_f_star
(i1: gen_elim_i)
(f1: gen_elim_t i1)
(i2: gen_elim_i)
(f2: gen_elim_t i2)
: GTot (gen_elim_t (GEStar i1 i2))
= fun _ ->
rewrite (compute_gen_elim_p (GEStar i1 i2)) (compute_gen_elim_p i1 `star` compute_gen_elim_p i2);
let res1 = f1 _ in
let res2 = f2 _ in
let res : compute_gen_elim_a (GEStar i1 i2) = coerce_with_trefl (res1, res2) in
rewrite (compute_gen_elim_q i1 res1 `star` compute_gen_elim_q i2 res2) (compute_gen_elim_q (GEStar i1 i2) res);
res
let compute_gen_elim_f_exists_no_abs0
(a: Type0)
(body: (a -> vprop))
: GTot (gen_elim_t (GEExistsNoAbs0 body))
= fun _ ->
rewrite (compute_gen_elim_p (GEExistsNoAbs0 body)) (exists_ body);
let gres = elim_exists () in
let res : compute_gen_elim_a (GEExistsNoAbs0 body) = U.raise_val (Ghost.reveal gres) in // coerce_with_trefl (Ghost.reveal gres) in
rewrite (body gres) (compute_gen_elim_q (GEExistsNoAbs0 body) res);
res
let rewrite_with_trefl (#opened:_) (p q:vprop)
: STGhost unit opened
p
(fun _ -> q)
(requires T.with_tactic T.trefl (p == q))
(ensures fun _ -> True)
= rewrite p q
let compute_gen_elim_f_exists_unit0
(a: Type0)
(body: a -> gen_unit_elim_i)
: Tot (gen_elim_t (GEExistsUnit0 body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p (GEExistsUnit0 body)) (exists_ (fun x -> compute_gen_unit_elim_p (body x)));
let gres = elim_exists () in
let _ = compute_gen_unit_elim_f (body gres) _ in
let res : compute_gen_elim_a (GEExistsUnit0 body) = U.raise_val (Ghost.reveal gres) in // coerce_with_trefl (Ghost.reveal gres) in
rewrite (compute_gen_unit_elim_q (body gres)) (compute_gen_elim_q (GEExistsUnit0 body) res);
res
let compute_gen_elim_f_exists0
(a: Type0)
(body: a -> gen_elim_i)
(f: (x: a) -> GTot (gen_elim_t (body x)))
: Tot (gen_elim_t (GEExists0 body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p (GEExists0 body)) (exists_ (fun x -> compute_gen_elim_p (body x)));
let gres1 = elim_exists () in
let gres2 = f gres1 _ in
let res : compute_gen_elim_a (GEExists0 body) = coerce_with_trefl (Mkdtuple2 #a #(fun x -> compute_gen_elim_a (body x)) (Ghost.reveal gres1) (Ghost.reveal gres2)) in
rewrite (compute_gen_elim_q (body gres1) gres2) (compute_gen_elim_q (GEExists0 body) res);
res
let compute_gen_elim_f_exists_no_abs1
(a: Type)
(body: (a -> vprop))
: GTot (gen_elim_t (GEExistsNoAbs1 body))
= fun _ ->
rewrite (compute_gen_elim_p (GEExistsNoAbs1 body)) (exists_ body);
let gres = elim_exists () in
let res : compute_gen_elim_a (GEExistsNoAbs1 body) = coerce_with_trefl (Ghost.reveal gres) in
rewrite (body gres) (compute_gen_elim_q (GEExistsNoAbs1 body) res);
res
let compute_gen_elim_f_exists_unit1
(a: Type)
(body: a -> gen_unit_elim_i)
: Tot (gen_elim_t (GEExistsUnit1 body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p (GEExistsUnit1 body)) (exists_ (fun x -> compute_gen_unit_elim_p (body x)));
let gres = elim_exists () in
let _ = compute_gen_unit_elim_f (body gres) _ in
let res : compute_gen_elim_a (GEExistsUnit1 body) = coerce_with_trefl (Ghost.reveal gres) in
rewrite (compute_gen_unit_elim_q (body gres)) (compute_gen_elim_q (GEExistsUnit1 body) res);
res
let compute_gen_elim_f_exists1
(a: Type)
(body: a -> gen_elim_i)
(f: (x: a) -> GTot (gen_elim_t (body x)))
: Tot (gen_elim_t (GEExists1 body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p (GEExists1 body)) (exists_ (fun x -> compute_gen_elim_p (body x)));
let gres1 = elim_exists () in
let gres2 = f gres1 _ in
let res : compute_gen_elim_a (GEExists1 body) = coerce_with_trefl (Mkdtuple2 #a #(fun x -> compute_gen_elim_a (body x)) (Ghost.reveal gres1) (Ghost.reveal gres2)) in
rewrite (compute_gen_elim_q (body gres1) gres2) (compute_gen_elim_q (GEExists1 body) res);
res
let rec compute_gen_elim_f
(i: gen_elim_i)
: GTot (gen_elim_t i)
= match i returns (gen_elim_t i) with
| GEUnit i -> compute_gen_elim_f_unit i
| GEStarL i1 i2 -> compute_gen_elim_f_star_l i1 (compute_gen_elim_f i1) i2
| GEStarR i1 i2 -> compute_gen_elim_f_star_r i1 i2 (compute_gen_elim_f i2)
| GEStar i1 i2 -> compute_gen_elim_f_star i1 (compute_gen_elim_f i1) i2 (compute_gen_elim_f i2)
| GEExistsNoAbs0 body -> compute_gen_elim_f_exists_no_abs0 _ body
| GEExistsUnit0 body -> compute_gen_elim_f_exists_unit0 _ body
| GEExists0 body -> compute_gen_elim_f_exists0 _ body (fun x -> compute_gen_elim_f (body x))
| GEExistsNoAbs1 body -> compute_gen_elim_f_exists_no_abs1 _ body
| GEExistsUnit1 body -> compute_gen_elim_f_exists_unit1 _ body
| GEExists1 body -> compute_gen_elim_f_exists1 _ body (fun x -> compute_gen_elim_f (body x))
let rec tele_p (x: gen_elim_tele) : Tot vprop =
match x with
| TRet v p -> v `star` pure p
| TExists ty body -> exists_ (fun x -> tele_p (body x))
let elim_exists' (#a:Type)
(#opened_invariants:_)
(#p:a -> vprop)
(_:unit)
: STGhostT (a) opened_invariants
(exists_ p)
(fun x -> p x)
= let gx = elim_exists () in
let x = Ghost.reveal gx in
rewrite (p gx) (p x);
x
let vprop_rewrite (from to: vprop) : Tot Type =
gen_elim_f from unit (fun _ -> to) (fun _ -> True)
let tele_star_vprop_correct_ret
(v': vprop) (p': prop) (v: vprop) (p: prop)
: Tot (vprop_rewrite (tele_p (TRet v' p') `star` v `star` pure p) (tele_p (tele_star_vprop (TRet v' p') v p)))
= fun _ ->
elim_pure p;
rewrite (tele_p _) (v' `star` pure p');
elim_pure p';
intro_pure (p /\ p');
rewrite ((v `star` v') `star` pure (p /\ p')) (tele_p _)
let tele_star_vprop_correct_exists
(v: vprop) (p: prop)
(ty: _) (body: ty -> gen_elim_tele) (ih: (x: ty) -> GTot (vprop_rewrite (tele_p (body x) `star` v `star` pure p) (tele_p (tele_star_vprop (body x) v p))))
: Tot (vprop_rewrite (tele_p (TExists ty body) `star` v `star` pure p) (tele_p (tele_star_vprop (TExists ty body) v p)))
= fun _ ->
rewrite_with_trefl (tele_p _) (exists_ (fun x -> tele_p (body x)));
let x = elim_exists' () in
ih x _;
intro_exists x (fun x -> tele_p (tele_star_vprop (body x) v p));
rewrite_with_trefl (exists_ (fun x -> tele_p (tele_star_vprop (body x) v p))) (tele_p _)
let rec tele_star_vprop_correct
(i: gen_elim_tele) (v: vprop) (p: prop)
: GTot (vprop_rewrite
(tele_p i `star` v `star` pure p)
(tele_p (tele_star_vprop i v p))
)
= match i returns vprop_rewrite
(tele_p i `star` v `star` pure p)
(tele_p (tele_star_vprop i v p)) with
| TRet v' p' -> tele_star_vprop_correct_ret v' p' v p
| TExists ty body -> tele_star_vprop_correct_exists v p ty body (fun x -> tele_star_vprop_correct (body x) v p)
let tele_star_correct_ret_l
(v1: vprop) (p1: prop) (i2: gen_elim_tele)
: Tot (vprop_rewrite (tele_p (TRet v1 p1) `star` tele_p i2) (tele_p (TRet v1 p1 `tele_star` i2)))
= fun _ ->
rewrite (tele_p (TRet v1 p1)) (v1 `star` pure p1);
tele_star_vprop_correct i2 v1 p1 _;
rewrite (tele_p _) (tele_p _)
let tele_star_correct_ret_r
(i1: gen_elim_tele { ~ (TRet? i1) }) (v2: vprop) (p2: prop)
: Tot (vprop_rewrite (tele_p i1 `star` tele_p (TRet v2 p2)) (tele_p (i1 `tele_star` TRet v2 p2)))
= fun _ ->
rewrite (tele_p (TRet v2 p2)) (v2 `star` pure p2);
tele_star_vprop_correct i1 v2 p2 _;
rewrite (tele_p _) (tele_p (i1 `tele_star` TRet v2 p2))
let tele_star_correct_exists
(ty1: _) (f1: ty1 -> gen_elim_tele) (ty2: _) (f2: ty2 -> gen_elim_tele)
(ih: (x1: ty1) -> (x2: ty2) -> GTot (vprop_rewrite (tele_p (f1 x1) `star` tele_p (f2 x2)) (tele_p (f1 x1 `tele_star` f2 x2))))
: Tot (vprop_rewrite (tele_p (TExists ty1 f1) `star` tele_p (TExists ty2 f2)) (tele_p (tele_star (TExists ty1 f1) (TExists ty2 f2))))
= fun _ ->
rewrite_with_trefl (tele_p (TExists ty1 f1)) (exists_ (fun x1 -> tele_p (f1 x1)));
let x1 = elim_exists' () in
rewrite_with_trefl (tele_p (TExists ty2 f2)) (exists_ (fun x2 -> tele_p (f2 x2)));
let x2 = elim_exists' () in
ih x1 x2 _;
intro_exists x2 (fun x2 -> tele_p (tele_star (f1 x1) (f2 x2)));
intro_exists x1 (fun x1 -> exists_ (fun x2 -> tele_p (tele_star (f1 x1) (f2 x2))));
rewrite_with_trefl (exists_ _) (tele_p _)
let rec tele_star_correct
(i1 i2: gen_elim_tele)
: GTot (vprop_rewrite (tele_p i1 `star` tele_p i2) (tele_p (i1 `tele_star` i2)))
= match i1 returns vprop_rewrite (tele_p i1 `star` tele_p i2) (tele_p (i1 `tele_star` i2)) with
| TRet v1 p1 -> tele_star_correct_ret_l v1 p1 i2
| TExists ty1 f1 ->
begin match i2 returns vprop_rewrite (tele_p (TExists ty1 f1) `star` tele_p i2) (tele_p (TExists ty1 f1 `tele_star` i2)) with
| TRet v2 p2 -> tele_star_correct_ret_r (TExists ty1 f1) v2 p2
| TExists ty2 f2 -> tele_star_correct_exists ty1 f1 ty2 f2 (fun x1 x2 -> tele_star_correct (f1 x1) (f2 x2))
end
[@@noextract_to "Plugin" ]
let ge_to_tele_t
(i: gen_elim_i)
: Tot Type
= vprop_rewrite (compute_gen_elim_p i) (tele_p (compute_gen_elim_tele i))
let compute_gen_elim_tele_correct_unit
(v: gen_unit_elim_i)
: Tot (ge_to_tele_t (GEUnit v))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (compute_gen_unit_elim_p v);
let _ = compute_gen_unit_elim_f v _ in
intro_pure (compute_gen_unit_elim_post v);
rewrite_with_trefl (compute_gen_unit_elim_q v `star` pure _) (tele_p _)
let compute_gen_elim_tele_correct_star_l
(l: gen_elim_i)
(ihl: ge_to_tele_t l)
(ru: gen_unit_elim_i)
: Tot (ge_to_tele_t (GEStarL l ru))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (compute_gen_elim_p l `star` compute_gen_unit_elim_p ru);
ihl _;
let _ = compute_gen_unit_elim_f ru _ in
intro_pure (compute_gen_unit_elim_post ru);
tele_star_vprop_correct _ _ _ _;
rewrite_with_trefl (tele_p _) (tele_p _)
let compute_gen_elim_tele_correct_star_r
(lu: gen_unit_elim_i)
(r: gen_elim_i)
(ihr: ge_to_tele_t r)
: Tot (ge_to_tele_t (GEStarR lu r))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (compute_gen_unit_elim_p lu `star` compute_gen_elim_p r);
ihr _;
let _ = compute_gen_unit_elim_f lu _ in
intro_pure (compute_gen_unit_elim_post lu);
tele_star_vprop_correct _ _ _ _;
rewrite_with_trefl (tele_p _) (tele_p _)
let compute_gen_elim_tele_correct_star
(l: gen_elim_i)
(ihl: ge_to_tele_t l)
(r: gen_elim_i)
(ihr: ge_to_tele_t r)
: Tot (ge_to_tele_t (GEStar l r))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (compute_gen_elim_p l `star` compute_gen_elim_p r);
ihl _;
ihr _;
tele_star_correct (compute_gen_elim_tele l) (compute_gen_elim_tele r) _;
rewrite_with_trefl (tele_p _) (tele_p _)
let compute_gen_elim_tele_correct_exists_no_abs0
(ty: _)
(body: ty -> vprop)
: Tot (ge_to_tele_t (GEExistsNoAbs0 #ty body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (exists_ body);
let x = elim_exists' () in
intro_pure True;
rewrite (body x) (body (U.downgrade_val (U.raise_val x)));
intro_exists (U.raise_val u#0 u#1 x) (fun x -> body (U.downgrade_val x) `star` pure True);
rewrite_with_trefl (exists_ _) (tele_p _)
let compute_gen_elim_tele_correct_exists_unit0
(ty: _)
(body: ty -> gen_unit_elim_i)
: Tot (ge_to_tele_t (GEExistsUnit0 #ty body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (exists_ (fun x -> compute_gen_unit_elim_p (body x)));
let x = elim_exists' () in
let _ = compute_gen_unit_elim_f (body x) _ in
intro_pure (compute_gen_unit_elim_post (body (U.downgrade_val (U.raise_val u#0 u#1 x))));
rewrite (compute_gen_unit_elim_q (body x)) (compute_gen_unit_elim_q (body (U.downgrade_val (U.raise_val x))));
intro_exists (U.raise_val u#0 u#1 x) (fun x -> compute_gen_unit_elim_q (body (U.downgrade_val x)) `star` pure (compute_gen_unit_elim_post (body (U.downgrade_val x))));
rewrite_with_trefl (exists_ _) (tele_p _)
let compute_gen_elim_tele_correct_exists0
(ty: _)
(body: ty -> gen_elim_i)
(ih: (x: ty) -> GTot (ge_to_tele_t (body x)))
: Tot (ge_to_tele_t (GEExists0 #ty body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (exists_ (fun x -> compute_gen_elim_p (body x)));
let x = elim_exists' () in
ih x _;
rewrite (tele_p (compute_gen_elim_tele (body x))) (tele_p (compute_gen_elim_tele (body (U.downgrade_val (U.raise_val u#0 u#1 x)))));
intro_exists (U.raise_val u#0 u#1 x) (fun x -> tele_p (compute_gen_elim_tele (body (U.downgrade_val u#0 u#1 x))));
rewrite_with_trefl (exists_ _) (tele_p _)
let compute_gen_elim_tele_correct_exists_no_abs1
(ty: _)
(body: ty -> vprop)
: Tot (ge_to_tele_t (GEExistsNoAbs1 #ty body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (exists_ body);
let x = elim_exists' () in
intro_pure True;
intro_exists x (fun x -> body x `star` pure True);
rewrite_with_trefl (exists_ _) (tele_p _)
let compute_gen_elim_tele_correct_exists_unit1
(ty: _)
(body: ty -> gen_unit_elim_i)
: Tot (ge_to_tele_t (GEExistsUnit1 #ty body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (exists_ (fun x -> compute_gen_unit_elim_p (body x)));
let x = elim_exists' () in
let _ = compute_gen_unit_elim_f (body x) _ in
intro_pure (compute_gen_unit_elim_post (body x));
intro_exists x (fun x -> compute_gen_unit_elim_q (body x) `star` pure (compute_gen_unit_elim_post (body x)));
rewrite_with_trefl (exists_ _) (tele_p _)
let compute_gen_elim_tele_correct_exists1
(ty: _)
(body: ty -> gen_elim_i)
(ih: (x: ty) -> GTot (ge_to_tele_t (body x)))
: Tot (ge_to_tele_t (GEExists1 #ty body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (exists_ (fun x -> compute_gen_elim_p (body x)));
let x = elim_exists' () in
ih x _;
intro_exists x (fun x -> tele_p (compute_gen_elim_tele (body x)));
rewrite_with_trefl (exists_ _) (tele_p _)
let rec compute_gen_elim_tele_correct
(x: gen_elim_i)
: GTot (ge_to_tele_t x)
= match x returns ge_to_tele_t x with
| GEUnit v -> compute_gen_elim_tele_correct_unit v
| GEStarL l ru -> compute_gen_elim_tele_correct_star_l l (compute_gen_elim_tele_correct l) ru
| GEStarR lu r -> compute_gen_elim_tele_correct_star_r lu r (compute_gen_elim_tele_correct r)
| GEStar l r -> compute_gen_elim_tele_correct_star l (compute_gen_elim_tele_correct l) r (compute_gen_elim_tele_correct r)
| GEExistsNoAbs0 #ty body -> compute_gen_elim_tele_correct_exists_no_abs0 ty body
| GEExistsUnit0 #ty body -> compute_gen_elim_tele_correct_exists_unit0 ty body
| GEExists0 #ty body -> compute_gen_elim_tele_correct_exists0 ty body (fun x -> compute_gen_elim_tele_correct (body x))
| GEExistsNoAbs1 #ty body -> compute_gen_elim_tele_correct_exists_no_abs1 ty body
| GEExistsUnit1 #ty body -> compute_gen_elim_tele_correct_exists_unit1 ty body
| GEExists1 #ty body -> compute_gen_elim_tele_correct_exists1 ty body (fun x -> compute_gen_elim_tele_correct (body x))
let rec gen_elim_nondep_p (ty: list (Type u#a)) : Tot (curried_function_type ty (U.raise_t u#_ u#(max 2 a) unit -> vprop) -> curried_function_type ty (U.raise_t u#_ u#(max 2 a) unit -> prop) -> Tot vprop) =
match ty as ty' returns curried_function_type ty' (U.raise_t u#_ u#(max 2 a) unit -> vprop) -> curried_function_type ty' (U.raise_t u#_ u#(max 2 a) unit -> prop) -> Tot vprop with
| [] -> fun q post -> q (U.raise_val ()) `star` pure (post (U.raise_val ()))
| t :: tq -> fun q post -> exists_ (fun x -> gen_elim_nondep_p tq (q x) (post x))
let rec gen_elim_nondep_sem_correct
(ty: list (Type u#a))
: Tot ((q: curried_function_type ty _) -> (post: curried_function_type ty _) -> Lemma
(tele_p (gen_elim_nondep_sem ty q post) `equiv` gen_elim_nondep_p ty q post)
)
= match ty returns ((q: curried_function_type ty _) -> (post: curried_function_type ty _) -> Lemma
(tele_p (gen_elim_nondep_sem ty q post) `equiv` gen_elim_nondep_p ty q post)
)
with
| [] -> fun q post -> equiv_refl (q (U.raise_val ()) `star` pure (post (U.raise_val ())))
| ta :: tq -> fun q post ->
let phi
(x: ta)
: Lemma
(tele_p (gen_elim_nondep_sem tq (q x) (post x)) `equiv` gen_elim_nondep_p tq (q x) (post x))
= gen_elim_nondep_sem_correct tq (q x) (post x)
in
Classical.forall_intro phi;
let prf () : Lemma
(exists_ (fun x -> tele_p (gen_elim_nondep_sem tq (q x) (post x))) `equiv` exists_ (fun x -> gen_elim_nondep_p tq (q x) (post x)))
=
exists_equiv (fun x -> tele_p (gen_elim_nondep_sem tq (q x) (post x))) (fun x -> gen_elim_nondep_p tq (q x) (post x))
in
assert_norm (tele_p (gen_elim_nondep_sem (ta :: tq) q post) == exists_ (fun x -> tele_p (gen_elim_nondep_sem tq (q x) (post x))));
assert_norm (gen_elim_nondep_p (ta :: tq) q post == exists_ (fun x -> gen_elim_nondep_p tq (q x) (post x)));
prf ()
let compute_gen_elim_nondep_correct_t
(i0: gen_elim_i)
(ty: list (Type u#1))
: Tot Type
= (q: _) ->
(post: _) ->
(intro: vprop_rewrite (compute_gen_elim_p i0) (gen_elim_nondep_p ty q post)) ->
GTot (gen_elim_f
(compute_gen_elim_p i0)
(compute_gen_elim_nondep_a' ty)
(fun x -> compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) ty q x (U.raise_val ()))
(fun x -> compute_uncurry _ (fun _ -> True) ty post x (U.raise_val ()))
)
let compute_gen_elim_nondep_correct0
(i0: gen_elim_i)
: Tot (compute_gen_elim_nondep_correct_t i0 [])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (q (U.raise_val ()) `star` pure (post (U.raise_val ())));
let res = U.raise_val () in
elim_pure _;
rewrite_with_trefl (q (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct1
(i0: gen_elim_i)
(t1: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> q x1 (U.raise_val ()) `star` pure (post x1 (U.raise_val ()))));
let res = elim_exists' () in
elim_pure _;
rewrite_with_trefl (q _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct2
(i0: gen_elim_i)
(t1 t2: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> q x1 x2 (U.raise_val ()) `star` pure (post x1 x2 (U.raise_val ())))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let res = Mktuple2 x1 x2 in
elim_pure _;
rewrite_with_trefl (q _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct3
(i0: gen_elim_i)
(t1 t2 t3: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> q x1 x2 x3 (U.raise_val ()) `star` pure (post x1 x2 x3 (U.raise_val ()))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let res = Mktuple3 x1 x2 x3 in
elim_pure _;
rewrite_with_trefl (q _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct4
(i0: gen_elim_i)
(t1 t2 t3 t4: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> q x1 x2 x3 x4 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 (U.raise_val ())))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let res = Mktuple4 x1 x2 x3 x4 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct5
(i0: gen_elim_i)
(t1 t2 t3 t4 t5: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> q x1 x2 x3 x4 x5 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 (U.raise_val ()))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let res = Mktuple5 x1 x2 x3 x4 x5 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct6
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> q x1 x2 x3 x4 x5 x6 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 (U.raise_val ())))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let res = Mktuple6 x1 x2 x3 x4 x5 x6 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct7
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> q x1 x2 x3 x4 x5 x6 x7 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 (U.raise_val ()))))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let x7 = elim_exists' () in
let res = Mktuple7 x1 x2 x3 x4 x5 x6 x7 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct8
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7 t8: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> exists_ (fun x8 -> q x1 x2 x3 x4 x5 x6 x7 x8 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 x8 (U.raise_val ())))))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let x7 = elim_exists' () in
let x8 = elim_exists' () in
let res = Mktuple8 x1 x2 x3 x4 x5 x6 x7 x8 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct9
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7 t8 t9: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> exists_ (fun x8 -> exists_ (fun x9 -> q x1 x2 x3 x4 x5 x6 x7 x8 x9 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 x8 x9 (U.raise_val ()))))))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let x7 = elim_exists' () in
let x8 = elim_exists' () in
let x9 = elim_exists' () in
let res = Mktuple9 x1 x2 x3 x4 x5 x6 x7 x8 x9 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct10
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7 t8 t9 t10: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> exists_ (fun x8 -> exists_ (fun x9 -> exists_ (fun x10 -> q x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 (U.raise_val ())))))))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let x7 = elim_exists' () in
let x8 = elim_exists' () in
let x9 = elim_exists' () in
let x10 = elim_exists' () in
let res = Mktuple10 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct11
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> exists_ (fun x8 -> exists_ (fun x9 -> exists_ (fun x10 -> exists_ (fun x11 -> q x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 (U.raise_val ()))))))))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let x7 = elim_exists' () in
let x8 = elim_exists' () in
let x9 = elim_exists' () in
let x10 = elim_exists' () in
let x11 = elim_exists' () in
let res = Mktuple11 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.GenElim1.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Universe",
"short_module": "U"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Steel.ST.GenElim1.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"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 |
i0: Steel.ST.GenElim1.Base.gen_elim_i ->
t1: Type ->
t2: Type ->
t3: Type ->
t4: Type ->
t5: Type ->
t6: Type ->
t7: Type ->
t8: Type ->
t9: Type ->
t10: Type ->
t11: Type ->
t12: Type
-> Steel.ST.GenElim1.compute_gen_elim_nondep_correct_t i0
[t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12] | Prims.Tot | [
"total"
] | [] | [
"Steel.ST.GenElim1.Base.gen_elim_i",
"Steel.ST.GenElim1.Base.curried_function_type",
"Prims.Cons",
"Prims.Nil",
"FStar.Universe.raise_t",
"Prims.unit",
"Steel.Effect.Common.vprop",
"Prims.prop",
"Steel.ST.GenElim1.vprop_rewrite",
"Steel.ST.GenElim1.Base.compute_gen_elim_p",
"Steel.ST.GenElim1.gen_elim_nondep_p",
"Steel.Memory.inames",
"Steel.ST.GenElim1.Base.compute_gen_elim_nondep_a'",
"Steel.ST.GenElim1.rewrite_with_trefl",
"FStar.Universe.raise_val",
"Steel.ST.GenElim1.Base.compute_uncurry",
"Steel.ST.GenElim1.Base.compute_gen_elim_p'",
"Steel.ST.Util.elim_pure",
"FStar.Pervasives.Native.tuple12",
"FStar.Pervasives.Native.Mktuple12",
"Steel.ST.GenElim1.elim_exists'",
"Steel.Effect.Common.VStar",
"Steel.ST.Util.pure",
"Steel.ST.Util.exists_",
"Steel.Effect.Common.star",
"Steel.ST.GenElim1.compute_gen_elim_nondep_correct_t"
] | [] | false | false | false | false | false | let compute_gen_elim_nondep_correct12
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12]) =
| fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _)
(exists_ (fun x1 ->
exists_ (fun x2 ->
exists_ (fun x3 ->
exists_ (fun x4 ->
exists_ (fun x5 ->
exists_ (fun x6 ->
exists_ (fun x7 ->
exists_ (fun x8 ->
exists_ (fun x9 ->
exists_ (fun x10 ->
exists_ (fun x11 ->
exists_ (fun x12 ->
(q x1 x2 x3 x4 x5 x6
x7 x8 x9 x10 x11
x12
(U.raise_val ()))
`star`
(pure (post x1 x2 x3
x4 x5 x6 x7 x8
x9 x10 x11 x12
(U.raise_val ()
))))))))))))
))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let x7 = elim_exists' () in
let x8 = elim_exists' () in
let x9 = elim_exists' () in
let x10 = elim_exists' () in
let x11 = elim_exists' () in
let x12 = elim_exists' () in
let res = Mktuple12 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ _ _ _ _ _ _ (U.raise_val ()))
(compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res | false |
Steel.ST.GenElim1.fst | Steel.ST.GenElim1.compute_gen_elim_nondep_correct13 | val compute_gen_elim_nondep_correct13
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13: Type)
: Tot
(compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12; t13]) | val compute_gen_elim_nondep_correct13
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13: Type)
: Tot
(compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12; t13]) | let compute_gen_elim_nondep_correct13
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12; t13])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> exists_ (fun x8 -> exists_ (fun x9 -> exists_ (fun x10 -> exists_ (fun x11 -> exists_ (fun x12 -> exists_ (fun x13 -> q x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 (U.raise_val ()))))))))))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let x7 = elim_exists' () in
let x8 = elim_exists' () in
let x9 = elim_exists' () in
let x10 = elim_exists' () in
let x11 = elim_exists' () in
let x12 = elim_exists' () in
let x13 = elim_exists' () in
let res = Mktuple13 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res | {
"file_name": "lib/steel/Steel.ST.GenElim1.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 7,
"end_line": 731,
"start_col": 0,
"start_line": 708
} | module Steel.ST.GenElim1
let gen_elim_f
(p: vprop)
(a: Type)
(q: (a -> vprop))
(post: (a -> prop))
: Tot Type
= ((opened: inames) -> STGhost a opened p q True post)
module U = FStar.Universe
let gen_unit_elim_t (i: gen_unit_elim_i) : Tot Type =
gen_elim_f (compute_gen_unit_elim_p i) (U.raise_t u#_ u#1 unit) (fun _ -> compute_gen_unit_elim_q i) (fun _ -> compute_gen_unit_elim_post i)
let compute_gen_unit_elim_f_id
(v: vprop)
: Tot (gen_unit_elim_t (GUEId v))
= fun _ -> noop (); U.raise_val ()
let compute_gen_unit_elim_f_pure
(p: prop)
: Tot (gen_unit_elim_t (GUEPure p))
= fun _ ->
rewrite (compute_gen_unit_elim_p (GUEPure p)) (pure p);
elim_pure p;
U.raise_val ()
let compute_gen_unit_elim_f_star
(i1 i2: gen_unit_elim_i)
(f1: gen_unit_elim_t i1)
(f2: gen_unit_elim_t i2)
: Tot (gen_unit_elim_t (GUEStar i1 i2))
= fun _ ->
rewrite (compute_gen_unit_elim_p (GUEStar i1 i2)) (compute_gen_unit_elim_p i1 `star` compute_gen_unit_elim_p i2);
let _ = f1 _ in
let _ = f2 _ in
rewrite (compute_gen_unit_elim_q i1 `star` compute_gen_unit_elim_q i2) (compute_gen_unit_elim_q (GUEStar i1 i2));
U.raise_val ()
let rec compute_gen_unit_elim_f
(i: gen_unit_elim_i)
: GTot (gen_unit_elim_t i)
= match i returns (gen_unit_elim_t i) with
| GUEId v -> compute_gen_unit_elim_f_id v
| GUEPure p -> compute_gen_unit_elim_f_pure p
| GUEStar i1 i2 -> compute_gen_unit_elim_f_star i1 i2 (compute_gen_unit_elim_f i1) (compute_gen_unit_elim_f i2)
let gen_elim_t (i: gen_elim_i) : Tot Type =
gen_elim_f (compute_gen_elim_p i) (compute_gen_elim_a i) (compute_gen_elim_q i) (compute_gen_elim_post i)
let compute_gen_elim_f_unit
(i: gen_unit_elim_i)
: GTot (gen_elim_t (GEUnit i))
= compute_gen_unit_elim_f i
let compute_gen_elim_f_star_l
(i1: gen_elim_i)
(f1: gen_elim_t i1)
(i2: gen_unit_elim_i)
: GTot (gen_elim_t (GEStarL i1 i2))
= let f2 = compute_gen_unit_elim_f i2 in
fun _ ->
rewrite (compute_gen_elim_p (GEStarL i1 i2)) (compute_gen_elim_p i1 `star` compute_gen_unit_elim_p i2);
let res = f1 _ in
let _ = f2 _ in
let res' : compute_gen_elim_a (GEStarL i1 i2) = coerce_with_trefl res in
rewrite (compute_gen_elim_q i1 res `star` compute_gen_unit_elim_q i2) (compute_gen_elim_q (GEStarL i1 i2) res');
res'
let compute_gen_elim_f_star_r
(i1: gen_unit_elim_i)
(i2: gen_elim_i)
(f2: gen_elim_t i2)
: GTot (gen_elim_t (GEStarR i1 i2))
= let f1 = compute_gen_unit_elim_f i1 in
fun _ ->
rewrite (compute_gen_elim_p (GEStarR i1 i2)) (compute_gen_unit_elim_p i1 `star` compute_gen_elim_p i2);
let _ = f1 _ in
let res = f2 _ in
let res' : compute_gen_elim_a (GEStarR i1 i2) = coerce_with_trefl res in
rewrite (compute_gen_unit_elim_q i1 `star` compute_gen_elim_q i2 res) (compute_gen_elim_q (GEStarR i1 i2) res');
res'
let compute_gen_elim_f_star
(i1: gen_elim_i)
(f1: gen_elim_t i1)
(i2: gen_elim_i)
(f2: gen_elim_t i2)
: GTot (gen_elim_t (GEStar i1 i2))
= fun _ ->
rewrite (compute_gen_elim_p (GEStar i1 i2)) (compute_gen_elim_p i1 `star` compute_gen_elim_p i2);
let res1 = f1 _ in
let res2 = f2 _ in
let res : compute_gen_elim_a (GEStar i1 i2) = coerce_with_trefl (res1, res2) in
rewrite (compute_gen_elim_q i1 res1 `star` compute_gen_elim_q i2 res2) (compute_gen_elim_q (GEStar i1 i2) res);
res
let compute_gen_elim_f_exists_no_abs0
(a: Type0)
(body: (a -> vprop))
: GTot (gen_elim_t (GEExistsNoAbs0 body))
= fun _ ->
rewrite (compute_gen_elim_p (GEExistsNoAbs0 body)) (exists_ body);
let gres = elim_exists () in
let res : compute_gen_elim_a (GEExistsNoAbs0 body) = U.raise_val (Ghost.reveal gres) in // coerce_with_trefl (Ghost.reveal gres) in
rewrite (body gres) (compute_gen_elim_q (GEExistsNoAbs0 body) res);
res
let rewrite_with_trefl (#opened:_) (p q:vprop)
: STGhost unit opened
p
(fun _ -> q)
(requires T.with_tactic T.trefl (p == q))
(ensures fun _ -> True)
= rewrite p q
let compute_gen_elim_f_exists_unit0
(a: Type0)
(body: a -> gen_unit_elim_i)
: Tot (gen_elim_t (GEExistsUnit0 body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p (GEExistsUnit0 body)) (exists_ (fun x -> compute_gen_unit_elim_p (body x)));
let gres = elim_exists () in
let _ = compute_gen_unit_elim_f (body gres) _ in
let res : compute_gen_elim_a (GEExistsUnit0 body) = U.raise_val (Ghost.reveal gres) in // coerce_with_trefl (Ghost.reveal gres) in
rewrite (compute_gen_unit_elim_q (body gres)) (compute_gen_elim_q (GEExistsUnit0 body) res);
res
let compute_gen_elim_f_exists0
(a: Type0)
(body: a -> gen_elim_i)
(f: (x: a) -> GTot (gen_elim_t (body x)))
: Tot (gen_elim_t (GEExists0 body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p (GEExists0 body)) (exists_ (fun x -> compute_gen_elim_p (body x)));
let gres1 = elim_exists () in
let gres2 = f gres1 _ in
let res : compute_gen_elim_a (GEExists0 body) = coerce_with_trefl (Mkdtuple2 #a #(fun x -> compute_gen_elim_a (body x)) (Ghost.reveal gres1) (Ghost.reveal gres2)) in
rewrite (compute_gen_elim_q (body gres1) gres2) (compute_gen_elim_q (GEExists0 body) res);
res
let compute_gen_elim_f_exists_no_abs1
(a: Type)
(body: (a -> vprop))
: GTot (gen_elim_t (GEExistsNoAbs1 body))
= fun _ ->
rewrite (compute_gen_elim_p (GEExistsNoAbs1 body)) (exists_ body);
let gres = elim_exists () in
let res : compute_gen_elim_a (GEExistsNoAbs1 body) = coerce_with_trefl (Ghost.reveal gres) in
rewrite (body gres) (compute_gen_elim_q (GEExistsNoAbs1 body) res);
res
let compute_gen_elim_f_exists_unit1
(a: Type)
(body: a -> gen_unit_elim_i)
: Tot (gen_elim_t (GEExistsUnit1 body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p (GEExistsUnit1 body)) (exists_ (fun x -> compute_gen_unit_elim_p (body x)));
let gres = elim_exists () in
let _ = compute_gen_unit_elim_f (body gres) _ in
let res : compute_gen_elim_a (GEExistsUnit1 body) = coerce_with_trefl (Ghost.reveal gres) in
rewrite (compute_gen_unit_elim_q (body gres)) (compute_gen_elim_q (GEExistsUnit1 body) res);
res
let compute_gen_elim_f_exists1
(a: Type)
(body: a -> gen_elim_i)
(f: (x: a) -> GTot (gen_elim_t (body x)))
: Tot (gen_elim_t (GEExists1 body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p (GEExists1 body)) (exists_ (fun x -> compute_gen_elim_p (body x)));
let gres1 = elim_exists () in
let gres2 = f gres1 _ in
let res : compute_gen_elim_a (GEExists1 body) = coerce_with_trefl (Mkdtuple2 #a #(fun x -> compute_gen_elim_a (body x)) (Ghost.reveal gres1) (Ghost.reveal gres2)) in
rewrite (compute_gen_elim_q (body gres1) gres2) (compute_gen_elim_q (GEExists1 body) res);
res
let rec compute_gen_elim_f
(i: gen_elim_i)
: GTot (gen_elim_t i)
= match i returns (gen_elim_t i) with
| GEUnit i -> compute_gen_elim_f_unit i
| GEStarL i1 i2 -> compute_gen_elim_f_star_l i1 (compute_gen_elim_f i1) i2
| GEStarR i1 i2 -> compute_gen_elim_f_star_r i1 i2 (compute_gen_elim_f i2)
| GEStar i1 i2 -> compute_gen_elim_f_star i1 (compute_gen_elim_f i1) i2 (compute_gen_elim_f i2)
| GEExistsNoAbs0 body -> compute_gen_elim_f_exists_no_abs0 _ body
| GEExistsUnit0 body -> compute_gen_elim_f_exists_unit0 _ body
| GEExists0 body -> compute_gen_elim_f_exists0 _ body (fun x -> compute_gen_elim_f (body x))
| GEExistsNoAbs1 body -> compute_gen_elim_f_exists_no_abs1 _ body
| GEExistsUnit1 body -> compute_gen_elim_f_exists_unit1 _ body
| GEExists1 body -> compute_gen_elim_f_exists1 _ body (fun x -> compute_gen_elim_f (body x))
let rec tele_p (x: gen_elim_tele) : Tot vprop =
match x with
| TRet v p -> v `star` pure p
| TExists ty body -> exists_ (fun x -> tele_p (body x))
let elim_exists' (#a:Type)
(#opened_invariants:_)
(#p:a -> vprop)
(_:unit)
: STGhostT (a) opened_invariants
(exists_ p)
(fun x -> p x)
= let gx = elim_exists () in
let x = Ghost.reveal gx in
rewrite (p gx) (p x);
x
let vprop_rewrite (from to: vprop) : Tot Type =
gen_elim_f from unit (fun _ -> to) (fun _ -> True)
let tele_star_vprop_correct_ret
(v': vprop) (p': prop) (v: vprop) (p: prop)
: Tot (vprop_rewrite (tele_p (TRet v' p') `star` v `star` pure p) (tele_p (tele_star_vprop (TRet v' p') v p)))
= fun _ ->
elim_pure p;
rewrite (tele_p _) (v' `star` pure p');
elim_pure p';
intro_pure (p /\ p');
rewrite ((v `star` v') `star` pure (p /\ p')) (tele_p _)
let tele_star_vprop_correct_exists
(v: vprop) (p: prop)
(ty: _) (body: ty -> gen_elim_tele) (ih: (x: ty) -> GTot (vprop_rewrite (tele_p (body x) `star` v `star` pure p) (tele_p (tele_star_vprop (body x) v p))))
: Tot (vprop_rewrite (tele_p (TExists ty body) `star` v `star` pure p) (tele_p (tele_star_vprop (TExists ty body) v p)))
= fun _ ->
rewrite_with_trefl (tele_p _) (exists_ (fun x -> tele_p (body x)));
let x = elim_exists' () in
ih x _;
intro_exists x (fun x -> tele_p (tele_star_vprop (body x) v p));
rewrite_with_trefl (exists_ (fun x -> tele_p (tele_star_vprop (body x) v p))) (tele_p _)
let rec tele_star_vprop_correct
(i: gen_elim_tele) (v: vprop) (p: prop)
: GTot (vprop_rewrite
(tele_p i `star` v `star` pure p)
(tele_p (tele_star_vprop i v p))
)
= match i returns vprop_rewrite
(tele_p i `star` v `star` pure p)
(tele_p (tele_star_vprop i v p)) with
| TRet v' p' -> tele_star_vprop_correct_ret v' p' v p
| TExists ty body -> tele_star_vprop_correct_exists v p ty body (fun x -> tele_star_vprop_correct (body x) v p)
let tele_star_correct_ret_l
(v1: vprop) (p1: prop) (i2: gen_elim_tele)
: Tot (vprop_rewrite (tele_p (TRet v1 p1) `star` tele_p i2) (tele_p (TRet v1 p1 `tele_star` i2)))
= fun _ ->
rewrite (tele_p (TRet v1 p1)) (v1 `star` pure p1);
tele_star_vprop_correct i2 v1 p1 _;
rewrite (tele_p _) (tele_p _)
let tele_star_correct_ret_r
(i1: gen_elim_tele { ~ (TRet? i1) }) (v2: vprop) (p2: prop)
: Tot (vprop_rewrite (tele_p i1 `star` tele_p (TRet v2 p2)) (tele_p (i1 `tele_star` TRet v2 p2)))
= fun _ ->
rewrite (tele_p (TRet v2 p2)) (v2 `star` pure p2);
tele_star_vprop_correct i1 v2 p2 _;
rewrite (tele_p _) (tele_p (i1 `tele_star` TRet v2 p2))
let tele_star_correct_exists
(ty1: _) (f1: ty1 -> gen_elim_tele) (ty2: _) (f2: ty2 -> gen_elim_tele)
(ih: (x1: ty1) -> (x2: ty2) -> GTot (vprop_rewrite (tele_p (f1 x1) `star` tele_p (f2 x2)) (tele_p (f1 x1 `tele_star` f2 x2))))
: Tot (vprop_rewrite (tele_p (TExists ty1 f1) `star` tele_p (TExists ty2 f2)) (tele_p (tele_star (TExists ty1 f1) (TExists ty2 f2))))
= fun _ ->
rewrite_with_trefl (tele_p (TExists ty1 f1)) (exists_ (fun x1 -> tele_p (f1 x1)));
let x1 = elim_exists' () in
rewrite_with_trefl (tele_p (TExists ty2 f2)) (exists_ (fun x2 -> tele_p (f2 x2)));
let x2 = elim_exists' () in
ih x1 x2 _;
intro_exists x2 (fun x2 -> tele_p (tele_star (f1 x1) (f2 x2)));
intro_exists x1 (fun x1 -> exists_ (fun x2 -> tele_p (tele_star (f1 x1) (f2 x2))));
rewrite_with_trefl (exists_ _) (tele_p _)
let rec tele_star_correct
(i1 i2: gen_elim_tele)
: GTot (vprop_rewrite (tele_p i1 `star` tele_p i2) (tele_p (i1 `tele_star` i2)))
= match i1 returns vprop_rewrite (tele_p i1 `star` tele_p i2) (tele_p (i1 `tele_star` i2)) with
| TRet v1 p1 -> tele_star_correct_ret_l v1 p1 i2
| TExists ty1 f1 ->
begin match i2 returns vprop_rewrite (tele_p (TExists ty1 f1) `star` tele_p i2) (tele_p (TExists ty1 f1 `tele_star` i2)) with
| TRet v2 p2 -> tele_star_correct_ret_r (TExists ty1 f1) v2 p2
| TExists ty2 f2 -> tele_star_correct_exists ty1 f1 ty2 f2 (fun x1 x2 -> tele_star_correct (f1 x1) (f2 x2))
end
[@@noextract_to "Plugin" ]
let ge_to_tele_t
(i: gen_elim_i)
: Tot Type
= vprop_rewrite (compute_gen_elim_p i) (tele_p (compute_gen_elim_tele i))
let compute_gen_elim_tele_correct_unit
(v: gen_unit_elim_i)
: Tot (ge_to_tele_t (GEUnit v))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (compute_gen_unit_elim_p v);
let _ = compute_gen_unit_elim_f v _ in
intro_pure (compute_gen_unit_elim_post v);
rewrite_with_trefl (compute_gen_unit_elim_q v `star` pure _) (tele_p _)
let compute_gen_elim_tele_correct_star_l
(l: gen_elim_i)
(ihl: ge_to_tele_t l)
(ru: gen_unit_elim_i)
: Tot (ge_to_tele_t (GEStarL l ru))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (compute_gen_elim_p l `star` compute_gen_unit_elim_p ru);
ihl _;
let _ = compute_gen_unit_elim_f ru _ in
intro_pure (compute_gen_unit_elim_post ru);
tele_star_vprop_correct _ _ _ _;
rewrite_with_trefl (tele_p _) (tele_p _)
let compute_gen_elim_tele_correct_star_r
(lu: gen_unit_elim_i)
(r: gen_elim_i)
(ihr: ge_to_tele_t r)
: Tot (ge_to_tele_t (GEStarR lu r))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (compute_gen_unit_elim_p lu `star` compute_gen_elim_p r);
ihr _;
let _ = compute_gen_unit_elim_f lu _ in
intro_pure (compute_gen_unit_elim_post lu);
tele_star_vprop_correct _ _ _ _;
rewrite_with_trefl (tele_p _) (tele_p _)
let compute_gen_elim_tele_correct_star
(l: gen_elim_i)
(ihl: ge_to_tele_t l)
(r: gen_elim_i)
(ihr: ge_to_tele_t r)
: Tot (ge_to_tele_t (GEStar l r))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (compute_gen_elim_p l `star` compute_gen_elim_p r);
ihl _;
ihr _;
tele_star_correct (compute_gen_elim_tele l) (compute_gen_elim_tele r) _;
rewrite_with_trefl (tele_p _) (tele_p _)
let compute_gen_elim_tele_correct_exists_no_abs0
(ty: _)
(body: ty -> vprop)
: Tot (ge_to_tele_t (GEExistsNoAbs0 #ty body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (exists_ body);
let x = elim_exists' () in
intro_pure True;
rewrite (body x) (body (U.downgrade_val (U.raise_val x)));
intro_exists (U.raise_val u#0 u#1 x) (fun x -> body (U.downgrade_val x) `star` pure True);
rewrite_with_trefl (exists_ _) (tele_p _)
let compute_gen_elim_tele_correct_exists_unit0
(ty: _)
(body: ty -> gen_unit_elim_i)
: Tot (ge_to_tele_t (GEExistsUnit0 #ty body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (exists_ (fun x -> compute_gen_unit_elim_p (body x)));
let x = elim_exists' () in
let _ = compute_gen_unit_elim_f (body x) _ in
intro_pure (compute_gen_unit_elim_post (body (U.downgrade_val (U.raise_val u#0 u#1 x))));
rewrite (compute_gen_unit_elim_q (body x)) (compute_gen_unit_elim_q (body (U.downgrade_val (U.raise_val x))));
intro_exists (U.raise_val u#0 u#1 x) (fun x -> compute_gen_unit_elim_q (body (U.downgrade_val x)) `star` pure (compute_gen_unit_elim_post (body (U.downgrade_val x))));
rewrite_with_trefl (exists_ _) (tele_p _)
let compute_gen_elim_tele_correct_exists0
(ty: _)
(body: ty -> gen_elim_i)
(ih: (x: ty) -> GTot (ge_to_tele_t (body x)))
: Tot (ge_to_tele_t (GEExists0 #ty body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (exists_ (fun x -> compute_gen_elim_p (body x)));
let x = elim_exists' () in
ih x _;
rewrite (tele_p (compute_gen_elim_tele (body x))) (tele_p (compute_gen_elim_tele (body (U.downgrade_val (U.raise_val u#0 u#1 x)))));
intro_exists (U.raise_val u#0 u#1 x) (fun x -> tele_p (compute_gen_elim_tele (body (U.downgrade_val u#0 u#1 x))));
rewrite_with_trefl (exists_ _) (tele_p _)
let compute_gen_elim_tele_correct_exists_no_abs1
(ty: _)
(body: ty -> vprop)
: Tot (ge_to_tele_t (GEExistsNoAbs1 #ty body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (exists_ body);
let x = elim_exists' () in
intro_pure True;
intro_exists x (fun x -> body x `star` pure True);
rewrite_with_trefl (exists_ _) (tele_p _)
let compute_gen_elim_tele_correct_exists_unit1
(ty: _)
(body: ty -> gen_unit_elim_i)
: Tot (ge_to_tele_t (GEExistsUnit1 #ty body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (exists_ (fun x -> compute_gen_unit_elim_p (body x)));
let x = elim_exists' () in
let _ = compute_gen_unit_elim_f (body x) _ in
intro_pure (compute_gen_unit_elim_post (body x));
intro_exists x (fun x -> compute_gen_unit_elim_q (body x) `star` pure (compute_gen_unit_elim_post (body x)));
rewrite_with_trefl (exists_ _) (tele_p _)
let compute_gen_elim_tele_correct_exists1
(ty: _)
(body: ty -> gen_elim_i)
(ih: (x: ty) -> GTot (ge_to_tele_t (body x)))
: Tot (ge_to_tele_t (GEExists1 #ty body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (exists_ (fun x -> compute_gen_elim_p (body x)));
let x = elim_exists' () in
ih x _;
intro_exists x (fun x -> tele_p (compute_gen_elim_tele (body x)));
rewrite_with_trefl (exists_ _) (tele_p _)
let rec compute_gen_elim_tele_correct
(x: gen_elim_i)
: GTot (ge_to_tele_t x)
= match x returns ge_to_tele_t x with
| GEUnit v -> compute_gen_elim_tele_correct_unit v
| GEStarL l ru -> compute_gen_elim_tele_correct_star_l l (compute_gen_elim_tele_correct l) ru
| GEStarR lu r -> compute_gen_elim_tele_correct_star_r lu r (compute_gen_elim_tele_correct r)
| GEStar l r -> compute_gen_elim_tele_correct_star l (compute_gen_elim_tele_correct l) r (compute_gen_elim_tele_correct r)
| GEExistsNoAbs0 #ty body -> compute_gen_elim_tele_correct_exists_no_abs0 ty body
| GEExistsUnit0 #ty body -> compute_gen_elim_tele_correct_exists_unit0 ty body
| GEExists0 #ty body -> compute_gen_elim_tele_correct_exists0 ty body (fun x -> compute_gen_elim_tele_correct (body x))
| GEExistsNoAbs1 #ty body -> compute_gen_elim_tele_correct_exists_no_abs1 ty body
| GEExistsUnit1 #ty body -> compute_gen_elim_tele_correct_exists_unit1 ty body
| GEExists1 #ty body -> compute_gen_elim_tele_correct_exists1 ty body (fun x -> compute_gen_elim_tele_correct (body x))
let rec gen_elim_nondep_p (ty: list (Type u#a)) : Tot (curried_function_type ty (U.raise_t u#_ u#(max 2 a) unit -> vprop) -> curried_function_type ty (U.raise_t u#_ u#(max 2 a) unit -> prop) -> Tot vprop) =
match ty as ty' returns curried_function_type ty' (U.raise_t u#_ u#(max 2 a) unit -> vprop) -> curried_function_type ty' (U.raise_t u#_ u#(max 2 a) unit -> prop) -> Tot vprop with
| [] -> fun q post -> q (U.raise_val ()) `star` pure (post (U.raise_val ()))
| t :: tq -> fun q post -> exists_ (fun x -> gen_elim_nondep_p tq (q x) (post x))
let rec gen_elim_nondep_sem_correct
(ty: list (Type u#a))
: Tot ((q: curried_function_type ty _) -> (post: curried_function_type ty _) -> Lemma
(tele_p (gen_elim_nondep_sem ty q post) `equiv` gen_elim_nondep_p ty q post)
)
= match ty returns ((q: curried_function_type ty _) -> (post: curried_function_type ty _) -> Lemma
(tele_p (gen_elim_nondep_sem ty q post) `equiv` gen_elim_nondep_p ty q post)
)
with
| [] -> fun q post -> equiv_refl (q (U.raise_val ()) `star` pure (post (U.raise_val ())))
| ta :: tq -> fun q post ->
let phi
(x: ta)
: Lemma
(tele_p (gen_elim_nondep_sem tq (q x) (post x)) `equiv` gen_elim_nondep_p tq (q x) (post x))
= gen_elim_nondep_sem_correct tq (q x) (post x)
in
Classical.forall_intro phi;
let prf () : Lemma
(exists_ (fun x -> tele_p (gen_elim_nondep_sem tq (q x) (post x))) `equiv` exists_ (fun x -> gen_elim_nondep_p tq (q x) (post x)))
=
exists_equiv (fun x -> tele_p (gen_elim_nondep_sem tq (q x) (post x))) (fun x -> gen_elim_nondep_p tq (q x) (post x))
in
assert_norm (tele_p (gen_elim_nondep_sem (ta :: tq) q post) == exists_ (fun x -> tele_p (gen_elim_nondep_sem tq (q x) (post x))));
assert_norm (gen_elim_nondep_p (ta :: tq) q post == exists_ (fun x -> gen_elim_nondep_p tq (q x) (post x)));
prf ()
let compute_gen_elim_nondep_correct_t
(i0: gen_elim_i)
(ty: list (Type u#1))
: Tot Type
= (q: _) ->
(post: _) ->
(intro: vprop_rewrite (compute_gen_elim_p i0) (gen_elim_nondep_p ty q post)) ->
GTot (gen_elim_f
(compute_gen_elim_p i0)
(compute_gen_elim_nondep_a' ty)
(fun x -> compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) ty q x (U.raise_val ()))
(fun x -> compute_uncurry _ (fun _ -> True) ty post x (U.raise_val ()))
)
let compute_gen_elim_nondep_correct0
(i0: gen_elim_i)
: Tot (compute_gen_elim_nondep_correct_t i0 [])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (q (U.raise_val ()) `star` pure (post (U.raise_val ())));
let res = U.raise_val () in
elim_pure _;
rewrite_with_trefl (q (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct1
(i0: gen_elim_i)
(t1: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> q x1 (U.raise_val ()) `star` pure (post x1 (U.raise_val ()))));
let res = elim_exists' () in
elim_pure _;
rewrite_with_trefl (q _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct2
(i0: gen_elim_i)
(t1 t2: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> q x1 x2 (U.raise_val ()) `star` pure (post x1 x2 (U.raise_val ())))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let res = Mktuple2 x1 x2 in
elim_pure _;
rewrite_with_trefl (q _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct3
(i0: gen_elim_i)
(t1 t2 t3: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> q x1 x2 x3 (U.raise_val ()) `star` pure (post x1 x2 x3 (U.raise_val ()))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let res = Mktuple3 x1 x2 x3 in
elim_pure _;
rewrite_with_trefl (q _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct4
(i0: gen_elim_i)
(t1 t2 t3 t4: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> q x1 x2 x3 x4 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 (U.raise_val ())))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let res = Mktuple4 x1 x2 x3 x4 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct5
(i0: gen_elim_i)
(t1 t2 t3 t4 t5: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> q x1 x2 x3 x4 x5 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 (U.raise_val ()))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let res = Mktuple5 x1 x2 x3 x4 x5 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct6
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> q x1 x2 x3 x4 x5 x6 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 (U.raise_val ())))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let res = Mktuple6 x1 x2 x3 x4 x5 x6 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct7
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> q x1 x2 x3 x4 x5 x6 x7 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 (U.raise_val ()))))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let x7 = elim_exists' () in
let res = Mktuple7 x1 x2 x3 x4 x5 x6 x7 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct8
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7 t8: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> exists_ (fun x8 -> q x1 x2 x3 x4 x5 x6 x7 x8 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 x8 (U.raise_val ())))))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let x7 = elim_exists' () in
let x8 = elim_exists' () in
let res = Mktuple8 x1 x2 x3 x4 x5 x6 x7 x8 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct9
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7 t8 t9: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> exists_ (fun x8 -> exists_ (fun x9 -> q x1 x2 x3 x4 x5 x6 x7 x8 x9 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 x8 x9 (U.raise_val ()))))))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let x7 = elim_exists' () in
let x8 = elim_exists' () in
let x9 = elim_exists' () in
let res = Mktuple9 x1 x2 x3 x4 x5 x6 x7 x8 x9 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct10
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7 t8 t9 t10: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> exists_ (fun x8 -> exists_ (fun x9 -> exists_ (fun x10 -> q x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 (U.raise_val ())))))))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let x7 = elim_exists' () in
let x8 = elim_exists' () in
let x9 = elim_exists' () in
let x10 = elim_exists' () in
let res = Mktuple10 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct11
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> exists_ (fun x8 -> exists_ (fun x9 -> exists_ (fun x10 -> exists_ (fun x11 -> q x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 (U.raise_val ()))))))))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let x7 = elim_exists' () in
let x8 = elim_exists' () in
let x9 = elim_exists' () in
let x10 = elim_exists' () in
let x11 = elim_exists' () in
let res = Mktuple11 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct12
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> exists_ (fun x8 -> exists_ (fun x9 -> exists_ (fun x10 -> exists_ (fun x11 -> exists_ (fun x12 -> q x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 (U.raise_val ())))))))))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let x7 = elim_exists' () in
let x8 = elim_exists' () in
let x9 = elim_exists' () in
let x10 = elim_exists' () in
let x11 = elim_exists' () in
let x12 = elim_exists' () in
let res = Mktuple12 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.GenElim1.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Universe",
"short_module": "U"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Steel.ST.GenElim1.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"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 |
i0: Steel.ST.GenElim1.Base.gen_elim_i ->
t1: Type ->
t2: Type ->
t3: Type ->
t4: Type ->
t5: Type ->
t6: Type ->
t7: Type ->
t8: Type ->
t9: Type ->
t10: Type ->
t11: Type ->
t12: Type ->
t13: Type
-> Steel.ST.GenElim1.compute_gen_elim_nondep_correct_t i0
[t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12; t13] | Prims.Tot | [
"total"
] | [] | [
"Steel.ST.GenElim1.Base.gen_elim_i",
"Steel.ST.GenElim1.Base.curried_function_type",
"Prims.Cons",
"Prims.Nil",
"FStar.Universe.raise_t",
"Prims.unit",
"Steel.Effect.Common.vprop",
"Prims.prop",
"Steel.ST.GenElim1.vprop_rewrite",
"Steel.ST.GenElim1.Base.compute_gen_elim_p",
"Steel.ST.GenElim1.gen_elim_nondep_p",
"Steel.Memory.inames",
"Steel.ST.GenElim1.Base.compute_gen_elim_nondep_a'",
"Steel.ST.GenElim1.rewrite_with_trefl",
"FStar.Universe.raise_val",
"Steel.ST.GenElim1.Base.compute_uncurry",
"Steel.ST.GenElim1.Base.compute_gen_elim_p'",
"Steel.ST.Util.elim_pure",
"FStar.Pervasives.Native.tuple13",
"FStar.Pervasives.Native.Mktuple13",
"Steel.ST.GenElim1.elim_exists'",
"Steel.Effect.Common.VStar",
"Steel.ST.Util.pure",
"Steel.ST.Util.exists_",
"Steel.Effect.Common.star",
"Steel.ST.GenElim1.compute_gen_elim_nondep_correct_t"
] | [] | false | false | false | false | false | let compute_gen_elim_nondep_correct13
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13: Type)
: Tot
(compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12; t13]) =
| fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _)
(exists_ (fun x1 ->
exists_ (fun x2 ->
exists_ (fun x3 ->
exists_ (fun x4 ->
exists_ (fun x5 ->
exists_ (fun x6 ->
exists_ (fun x7 ->
exists_ (fun x8 ->
exists_ (fun x9 ->
exists_ (fun x10 ->
exists_ (fun x11 ->
exists_ (fun x12 ->
exists_ (fun x13 ->
(q x1 x2 x3 x4
x5 x6 x7 x8
x9 x10 x11
x12 x13
(U.raise_val
()))
`star`
(pure (post x1
x2 x3 x4
x5 x6 x7
x8 x9
x10 x11
x12 x13
(U.raise_val
()))
)))))))))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let x7 = elim_exists' () in
let x8 = elim_exists' () in
let x9 = elim_exists' () in
let x10 = elim_exists' () in
let x11 = elim_exists' () in
let x12 = elim_exists' () in
let x13 = elim_exists' () in
let res = Mktuple13 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ _ _ _ _ _ _ _ (U.raise_val ()))
(compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res | false |
Steel.ST.GenElim1.fst | Steel.ST.GenElim1.compute_gen_elim_nondep_correct14 | val compute_gen_elim_nondep_correct14
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14: Type)
: Tot
(compute_gen_elim_nondep_correct_t i0
[t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12; t13; t14]) | val compute_gen_elim_nondep_correct14
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14: Type)
: Tot
(compute_gen_elim_nondep_correct_t i0
[t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12; t13; t14]) | let compute_gen_elim_nondep_correct14
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12; t13; t14])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> exists_ (fun x8 -> exists_ (fun x9 -> exists_ (fun x10 -> exists_ (fun x11 -> exists_ (fun x12 -> exists_ (fun x13 -> exists_ (fun x14 -> q x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 (U.raise_val ())))))))))))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let x7 = elim_exists' () in
let x8 = elim_exists' () in
let x9 = elim_exists' () in
let x10 = elim_exists' () in
let x11 = elim_exists' () in
let x12 = elim_exists' () in
let x13 = elim_exists' () in
let x14 = elim_exists' () in
let res = Mktuple14 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ _ _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res | {
"file_name": "lib/steel/Steel.ST.GenElim1.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 7,
"end_line": 757,
"start_col": 0,
"start_line": 733
} | module Steel.ST.GenElim1
let gen_elim_f
(p: vprop)
(a: Type)
(q: (a -> vprop))
(post: (a -> prop))
: Tot Type
= ((opened: inames) -> STGhost a opened p q True post)
module U = FStar.Universe
let gen_unit_elim_t (i: gen_unit_elim_i) : Tot Type =
gen_elim_f (compute_gen_unit_elim_p i) (U.raise_t u#_ u#1 unit) (fun _ -> compute_gen_unit_elim_q i) (fun _ -> compute_gen_unit_elim_post i)
let compute_gen_unit_elim_f_id
(v: vprop)
: Tot (gen_unit_elim_t (GUEId v))
= fun _ -> noop (); U.raise_val ()
let compute_gen_unit_elim_f_pure
(p: prop)
: Tot (gen_unit_elim_t (GUEPure p))
= fun _ ->
rewrite (compute_gen_unit_elim_p (GUEPure p)) (pure p);
elim_pure p;
U.raise_val ()
let compute_gen_unit_elim_f_star
(i1 i2: gen_unit_elim_i)
(f1: gen_unit_elim_t i1)
(f2: gen_unit_elim_t i2)
: Tot (gen_unit_elim_t (GUEStar i1 i2))
= fun _ ->
rewrite (compute_gen_unit_elim_p (GUEStar i1 i2)) (compute_gen_unit_elim_p i1 `star` compute_gen_unit_elim_p i2);
let _ = f1 _ in
let _ = f2 _ in
rewrite (compute_gen_unit_elim_q i1 `star` compute_gen_unit_elim_q i2) (compute_gen_unit_elim_q (GUEStar i1 i2));
U.raise_val ()
let rec compute_gen_unit_elim_f
(i: gen_unit_elim_i)
: GTot (gen_unit_elim_t i)
= match i returns (gen_unit_elim_t i) with
| GUEId v -> compute_gen_unit_elim_f_id v
| GUEPure p -> compute_gen_unit_elim_f_pure p
| GUEStar i1 i2 -> compute_gen_unit_elim_f_star i1 i2 (compute_gen_unit_elim_f i1) (compute_gen_unit_elim_f i2)
let gen_elim_t (i: gen_elim_i) : Tot Type =
gen_elim_f (compute_gen_elim_p i) (compute_gen_elim_a i) (compute_gen_elim_q i) (compute_gen_elim_post i)
let compute_gen_elim_f_unit
(i: gen_unit_elim_i)
: GTot (gen_elim_t (GEUnit i))
= compute_gen_unit_elim_f i
let compute_gen_elim_f_star_l
(i1: gen_elim_i)
(f1: gen_elim_t i1)
(i2: gen_unit_elim_i)
: GTot (gen_elim_t (GEStarL i1 i2))
= let f2 = compute_gen_unit_elim_f i2 in
fun _ ->
rewrite (compute_gen_elim_p (GEStarL i1 i2)) (compute_gen_elim_p i1 `star` compute_gen_unit_elim_p i2);
let res = f1 _ in
let _ = f2 _ in
let res' : compute_gen_elim_a (GEStarL i1 i2) = coerce_with_trefl res in
rewrite (compute_gen_elim_q i1 res `star` compute_gen_unit_elim_q i2) (compute_gen_elim_q (GEStarL i1 i2) res');
res'
let compute_gen_elim_f_star_r
(i1: gen_unit_elim_i)
(i2: gen_elim_i)
(f2: gen_elim_t i2)
: GTot (gen_elim_t (GEStarR i1 i2))
= let f1 = compute_gen_unit_elim_f i1 in
fun _ ->
rewrite (compute_gen_elim_p (GEStarR i1 i2)) (compute_gen_unit_elim_p i1 `star` compute_gen_elim_p i2);
let _ = f1 _ in
let res = f2 _ in
let res' : compute_gen_elim_a (GEStarR i1 i2) = coerce_with_trefl res in
rewrite (compute_gen_unit_elim_q i1 `star` compute_gen_elim_q i2 res) (compute_gen_elim_q (GEStarR i1 i2) res');
res'
let compute_gen_elim_f_star
(i1: gen_elim_i)
(f1: gen_elim_t i1)
(i2: gen_elim_i)
(f2: gen_elim_t i2)
: GTot (gen_elim_t (GEStar i1 i2))
= fun _ ->
rewrite (compute_gen_elim_p (GEStar i1 i2)) (compute_gen_elim_p i1 `star` compute_gen_elim_p i2);
let res1 = f1 _ in
let res2 = f2 _ in
let res : compute_gen_elim_a (GEStar i1 i2) = coerce_with_trefl (res1, res2) in
rewrite (compute_gen_elim_q i1 res1 `star` compute_gen_elim_q i2 res2) (compute_gen_elim_q (GEStar i1 i2) res);
res
let compute_gen_elim_f_exists_no_abs0
(a: Type0)
(body: (a -> vprop))
: GTot (gen_elim_t (GEExistsNoAbs0 body))
= fun _ ->
rewrite (compute_gen_elim_p (GEExistsNoAbs0 body)) (exists_ body);
let gres = elim_exists () in
let res : compute_gen_elim_a (GEExistsNoAbs0 body) = U.raise_val (Ghost.reveal gres) in // coerce_with_trefl (Ghost.reveal gres) in
rewrite (body gres) (compute_gen_elim_q (GEExistsNoAbs0 body) res);
res
let rewrite_with_trefl (#opened:_) (p q:vprop)
: STGhost unit opened
p
(fun _ -> q)
(requires T.with_tactic T.trefl (p == q))
(ensures fun _ -> True)
= rewrite p q
let compute_gen_elim_f_exists_unit0
(a: Type0)
(body: a -> gen_unit_elim_i)
: Tot (gen_elim_t (GEExistsUnit0 body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p (GEExistsUnit0 body)) (exists_ (fun x -> compute_gen_unit_elim_p (body x)));
let gres = elim_exists () in
let _ = compute_gen_unit_elim_f (body gres) _ in
let res : compute_gen_elim_a (GEExistsUnit0 body) = U.raise_val (Ghost.reveal gres) in // coerce_with_trefl (Ghost.reveal gres) in
rewrite (compute_gen_unit_elim_q (body gres)) (compute_gen_elim_q (GEExistsUnit0 body) res);
res
let compute_gen_elim_f_exists0
(a: Type0)
(body: a -> gen_elim_i)
(f: (x: a) -> GTot (gen_elim_t (body x)))
: Tot (gen_elim_t (GEExists0 body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p (GEExists0 body)) (exists_ (fun x -> compute_gen_elim_p (body x)));
let gres1 = elim_exists () in
let gres2 = f gres1 _ in
let res : compute_gen_elim_a (GEExists0 body) = coerce_with_trefl (Mkdtuple2 #a #(fun x -> compute_gen_elim_a (body x)) (Ghost.reveal gres1) (Ghost.reveal gres2)) in
rewrite (compute_gen_elim_q (body gres1) gres2) (compute_gen_elim_q (GEExists0 body) res);
res
let compute_gen_elim_f_exists_no_abs1
(a: Type)
(body: (a -> vprop))
: GTot (gen_elim_t (GEExistsNoAbs1 body))
= fun _ ->
rewrite (compute_gen_elim_p (GEExistsNoAbs1 body)) (exists_ body);
let gres = elim_exists () in
let res : compute_gen_elim_a (GEExistsNoAbs1 body) = coerce_with_trefl (Ghost.reveal gres) in
rewrite (body gres) (compute_gen_elim_q (GEExistsNoAbs1 body) res);
res
let compute_gen_elim_f_exists_unit1
(a: Type)
(body: a -> gen_unit_elim_i)
: Tot (gen_elim_t (GEExistsUnit1 body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p (GEExistsUnit1 body)) (exists_ (fun x -> compute_gen_unit_elim_p (body x)));
let gres = elim_exists () in
let _ = compute_gen_unit_elim_f (body gres) _ in
let res : compute_gen_elim_a (GEExistsUnit1 body) = coerce_with_trefl (Ghost.reveal gres) in
rewrite (compute_gen_unit_elim_q (body gres)) (compute_gen_elim_q (GEExistsUnit1 body) res);
res
let compute_gen_elim_f_exists1
(a: Type)
(body: a -> gen_elim_i)
(f: (x: a) -> GTot (gen_elim_t (body x)))
: Tot (gen_elim_t (GEExists1 body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p (GEExists1 body)) (exists_ (fun x -> compute_gen_elim_p (body x)));
let gres1 = elim_exists () in
let gres2 = f gres1 _ in
let res : compute_gen_elim_a (GEExists1 body) = coerce_with_trefl (Mkdtuple2 #a #(fun x -> compute_gen_elim_a (body x)) (Ghost.reveal gres1) (Ghost.reveal gres2)) in
rewrite (compute_gen_elim_q (body gres1) gres2) (compute_gen_elim_q (GEExists1 body) res);
res
let rec compute_gen_elim_f
(i: gen_elim_i)
: GTot (gen_elim_t i)
= match i returns (gen_elim_t i) with
| GEUnit i -> compute_gen_elim_f_unit i
| GEStarL i1 i2 -> compute_gen_elim_f_star_l i1 (compute_gen_elim_f i1) i2
| GEStarR i1 i2 -> compute_gen_elim_f_star_r i1 i2 (compute_gen_elim_f i2)
| GEStar i1 i2 -> compute_gen_elim_f_star i1 (compute_gen_elim_f i1) i2 (compute_gen_elim_f i2)
| GEExistsNoAbs0 body -> compute_gen_elim_f_exists_no_abs0 _ body
| GEExistsUnit0 body -> compute_gen_elim_f_exists_unit0 _ body
| GEExists0 body -> compute_gen_elim_f_exists0 _ body (fun x -> compute_gen_elim_f (body x))
| GEExistsNoAbs1 body -> compute_gen_elim_f_exists_no_abs1 _ body
| GEExistsUnit1 body -> compute_gen_elim_f_exists_unit1 _ body
| GEExists1 body -> compute_gen_elim_f_exists1 _ body (fun x -> compute_gen_elim_f (body x))
let rec tele_p (x: gen_elim_tele) : Tot vprop =
match x with
| TRet v p -> v `star` pure p
| TExists ty body -> exists_ (fun x -> tele_p (body x))
let elim_exists' (#a:Type)
(#opened_invariants:_)
(#p:a -> vprop)
(_:unit)
: STGhostT (a) opened_invariants
(exists_ p)
(fun x -> p x)
= let gx = elim_exists () in
let x = Ghost.reveal gx in
rewrite (p gx) (p x);
x
let vprop_rewrite (from to: vprop) : Tot Type =
gen_elim_f from unit (fun _ -> to) (fun _ -> True)
let tele_star_vprop_correct_ret
(v': vprop) (p': prop) (v: vprop) (p: prop)
: Tot (vprop_rewrite (tele_p (TRet v' p') `star` v `star` pure p) (tele_p (tele_star_vprop (TRet v' p') v p)))
= fun _ ->
elim_pure p;
rewrite (tele_p _) (v' `star` pure p');
elim_pure p';
intro_pure (p /\ p');
rewrite ((v `star` v') `star` pure (p /\ p')) (tele_p _)
let tele_star_vprop_correct_exists
(v: vprop) (p: prop)
(ty: _) (body: ty -> gen_elim_tele) (ih: (x: ty) -> GTot (vprop_rewrite (tele_p (body x) `star` v `star` pure p) (tele_p (tele_star_vprop (body x) v p))))
: Tot (vprop_rewrite (tele_p (TExists ty body) `star` v `star` pure p) (tele_p (tele_star_vprop (TExists ty body) v p)))
= fun _ ->
rewrite_with_trefl (tele_p _) (exists_ (fun x -> tele_p (body x)));
let x = elim_exists' () in
ih x _;
intro_exists x (fun x -> tele_p (tele_star_vprop (body x) v p));
rewrite_with_trefl (exists_ (fun x -> tele_p (tele_star_vprop (body x) v p))) (tele_p _)
let rec tele_star_vprop_correct
(i: gen_elim_tele) (v: vprop) (p: prop)
: GTot (vprop_rewrite
(tele_p i `star` v `star` pure p)
(tele_p (tele_star_vprop i v p))
)
= match i returns vprop_rewrite
(tele_p i `star` v `star` pure p)
(tele_p (tele_star_vprop i v p)) with
| TRet v' p' -> tele_star_vprop_correct_ret v' p' v p
| TExists ty body -> tele_star_vprop_correct_exists v p ty body (fun x -> tele_star_vprop_correct (body x) v p)
let tele_star_correct_ret_l
(v1: vprop) (p1: prop) (i2: gen_elim_tele)
: Tot (vprop_rewrite (tele_p (TRet v1 p1) `star` tele_p i2) (tele_p (TRet v1 p1 `tele_star` i2)))
= fun _ ->
rewrite (tele_p (TRet v1 p1)) (v1 `star` pure p1);
tele_star_vprop_correct i2 v1 p1 _;
rewrite (tele_p _) (tele_p _)
let tele_star_correct_ret_r
(i1: gen_elim_tele { ~ (TRet? i1) }) (v2: vprop) (p2: prop)
: Tot (vprop_rewrite (tele_p i1 `star` tele_p (TRet v2 p2)) (tele_p (i1 `tele_star` TRet v2 p2)))
= fun _ ->
rewrite (tele_p (TRet v2 p2)) (v2 `star` pure p2);
tele_star_vprop_correct i1 v2 p2 _;
rewrite (tele_p _) (tele_p (i1 `tele_star` TRet v2 p2))
let tele_star_correct_exists
(ty1: _) (f1: ty1 -> gen_elim_tele) (ty2: _) (f2: ty2 -> gen_elim_tele)
(ih: (x1: ty1) -> (x2: ty2) -> GTot (vprop_rewrite (tele_p (f1 x1) `star` tele_p (f2 x2)) (tele_p (f1 x1 `tele_star` f2 x2))))
: Tot (vprop_rewrite (tele_p (TExists ty1 f1) `star` tele_p (TExists ty2 f2)) (tele_p (tele_star (TExists ty1 f1) (TExists ty2 f2))))
= fun _ ->
rewrite_with_trefl (tele_p (TExists ty1 f1)) (exists_ (fun x1 -> tele_p (f1 x1)));
let x1 = elim_exists' () in
rewrite_with_trefl (tele_p (TExists ty2 f2)) (exists_ (fun x2 -> tele_p (f2 x2)));
let x2 = elim_exists' () in
ih x1 x2 _;
intro_exists x2 (fun x2 -> tele_p (tele_star (f1 x1) (f2 x2)));
intro_exists x1 (fun x1 -> exists_ (fun x2 -> tele_p (tele_star (f1 x1) (f2 x2))));
rewrite_with_trefl (exists_ _) (tele_p _)
let rec tele_star_correct
(i1 i2: gen_elim_tele)
: GTot (vprop_rewrite (tele_p i1 `star` tele_p i2) (tele_p (i1 `tele_star` i2)))
= match i1 returns vprop_rewrite (tele_p i1 `star` tele_p i2) (tele_p (i1 `tele_star` i2)) with
| TRet v1 p1 -> tele_star_correct_ret_l v1 p1 i2
| TExists ty1 f1 ->
begin match i2 returns vprop_rewrite (tele_p (TExists ty1 f1) `star` tele_p i2) (tele_p (TExists ty1 f1 `tele_star` i2)) with
| TRet v2 p2 -> tele_star_correct_ret_r (TExists ty1 f1) v2 p2
| TExists ty2 f2 -> tele_star_correct_exists ty1 f1 ty2 f2 (fun x1 x2 -> tele_star_correct (f1 x1) (f2 x2))
end
[@@noextract_to "Plugin" ]
let ge_to_tele_t
(i: gen_elim_i)
: Tot Type
= vprop_rewrite (compute_gen_elim_p i) (tele_p (compute_gen_elim_tele i))
let compute_gen_elim_tele_correct_unit
(v: gen_unit_elim_i)
: Tot (ge_to_tele_t (GEUnit v))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (compute_gen_unit_elim_p v);
let _ = compute_gen_unit_elim_f v _ in
intro_pure (compute_gen_unit_elim_post v);
rewrite_with_trefl (compute_gen_unit_elim_q v `star` pure _) (tele_p _)
let compute_gen_elim_tele_correct_star_l
(l: gen_elim_i)
(ihl: ge_to_tele_t l)
(ru: gen_unit_elim_i)
: Tot (ge_to_tele_t (GEStarL l ru))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (compute_gen_elim_p l `star` compute_gen_unit_elim_p ru);
ihl _;
let _ = compute_gen_unit_elim_f ru _ in
intro_pure (compute_gen_unit_elim_post ru);
tele_star_vprop_correct _ _ _ _;
rewrite_with_trefl (tele_p _) (tele_p _)
let compute_gen_elim_tele_correct_star_r
(lu: gen_unit_elim_i)
(r: gen_elim_i)
(ihr: ge_to_tele_t r)
: Tot (ge_to_tele_t (GEStarR lu r))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (compute_gen_unit_elim_p lu `star` compute_gen_elim_p r);
ihr _;
let _ = compute_gen_unit_elim_f lu _ in
intro_pure (compute_gen_unit_elim_post lu);
tele_star_vprop_correct _ _ _ _;
rewrite_with_trefl (tele_p _) (tele_p _)
let compute_gen_elim_tele_correct_star
(l: gen_elim_i)
(ihl: ge_to_tele_t l)
(r: gen_elim_i)
(ihr: ge_to_tele_t r)
: Tot (ge_to_tele_t (GEStar l r))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (compute_gen_elim_p l `star` compute_gen_elim_p r);
ihl _;
ihr _;
tele_star_correct (compute_gen_elim_tele l) (compute_gen_elim_tele r) _;
rewrite_with_trefl (tele_p _) (tele_p _)
let compute_gen_elim_tele_correct_exists_no_abs0
(ty: _)
(body: ty -> vprop)
: Tot (ge_to_tele_t (GEExistsNoAbs0 #ty body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (exists_ body);
let x = elim_exists' () in
intro_pure True;
rewrite (body x) (body (U.downgrade_val (U.raise_val x)));
intro_exists (U.raise_val u#0 u#1 x) (fun x -> body (U.downgrade_val x) `star` pure True);
rewrite_with_trefl (exists_ _) (tele_p _)
let compute_gen_elim_tele_correct_exists_unit0
(ty: _)
(body: ty -> gen_unit_elim_i)
: Tot (ge_to_tele_t (GEExistsUnit0 #ty body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (exists_ (fun x -> compute_gen_unit_elim_p (body x)));
let x = elim_exists' () in
let _ = compute_gen_unit_elim_f (body x) _ in
intro_pure (compute_gen_unit_elim_post (body (U.downgrade_val (U.raise_val u#0 u#1 x))));
rewrite (compute_gen_unit_elim_q (body x)) (compute_gen_unit_elim_q (body (U.downgrade_val (U.raise_val x))));
intro_exists (U.raise_val u#0 u#1 x) (fun x -> compute_gen_unit_elim_q (body (U.downgrade_val x)) `star` pure (compute_gen_unit_elim_post (body (U.downgrade_val x))));
rewrite_with_trefl (exists_ _) (tele_p _)
let compute_gen_elim_tele_correct_exists0
(ty: _)
(body: ty -> gen_elim_i)
(ih: (x: ty) -> GTot (ge_to_tele_t (body x)))
: Tot (ge_to_tele_t (GEExists0 #ty body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (exists_ (fun x -> compute_gen_elim_p (body x)));
let x = elim_exists' () in
ih x _;
rewrite (tele_p (compute_gen_elim_tele (body x))) (tele_p (compute_gen_elim_tele (body (U.downgrade_val (U.raise_val u#0 u#1 x)))));
intro_exists (U.raise_val u#0 u#1 x) (fun x -> tele_p (compute_gen_elim_tele (body (U.downgrade_val u#0 u#1 x))));
rewrite_with_trefl (exists_ _) (tele_p _)
let compute_gen_elim_tele_correct_exists_no_abs1
(ty: _)
(body: ty -> vprop)
: Tot (ge_to_tele_t (GEExistsNoAbs1 #ty body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (exists_ body);
let x = elim_exists' () in
intro_pure True;
intro_exists x (fun x -> body x `star` pure True);
rewrite_with_trefl (exists_ _) (tele_p _)
let compute_gen_elim_tele_correct_exists_unit1
(ty: _)
(body: ty -> gen_unit_elim_i)
: Tot (ge_to_tele_t (GEExistsUnit1 #ty body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (exists_ (fun x -> compute_gen_unit_elim_p (body x)));
let x = elim_exists' () in
let _ = compute_gen_unit_elim_f (body x) _ in
intro_pure (compute_gen_unit_elim_post (body x));
intro_exists x (fun x -> compute_gen_unit_elim_q (body x) `star` pure (compute_gen_unit_elim_post (body x)));
rewrite_with_trefl (exists_ _) (tele_p _)
let compute_gen_elim_tele_correct_exists1
(ty: _)
(body: ty -> gen_elim_i)
(ih: (x: ty) -> GTot (ge_to_tele_t (body x)))
: Tot (ge_to_tele_t (GEExists1 #ty body))
= fun _ ->
rewrite_with_trefl (compute_gen_elim_p _) (exists_ (fun x -> compute_gen_elim_p (body x)));
let x = elim_exists' () in
ih x _;
intro_exists x (fun x -> tele_p (compute_gen_elim_tele (body x)));
rewrite_with_trefl (exists_ _) (tele_p _)
let rec compute_gen_elim_tele_correct
(x: gen_elim_i)
: GTot (ge_to_tele_t x)
= match x returns ge_to_tele_t x with
| GEUnit v -> compute_gen_elim_tele_correct_unit v
| GEStarL l ru -> compute_gen_elim_tele_correct_star_l l (compute_gen_elim_tele_correct l) ru
| GEStarR lu r -> compute_gen_elim_tele_correct_star_r lu r (compute_gen_elim_tele_correct r)
| GEStar l r -> compute_gen_elim_tele_correct_star l (compute_gen_elim_tele_correct l) r (compute_gen_elim_tele_correct r)
| GEExistsNoAbs0 #ty body -> compute_gen_elim_tele_correct_exists_no_abs0 ty body
| GEExistsUnit0 #ty body -> compute_gen_elim_tele_correct_exists_unit0 ty body
| GEExists0 #ty body -> compute_gen_elim_tele_correct_exists0 ty body (fun x -> compute_gen_elim_tele_correct (body x))
| GEExistsNoAbs1 #ty body -> compute_gen_elim_tele_correct_exists_no_abs1 ty body
| GEExistsUnit1 #ty body -> compute_gen_elim_tele_correct_exists_unit1 ty body
| GEExists1 #ty body -> compute_gen_elim_tele_correct_exists1 ty body (fun x -> compute_gen_elim_tele_correct (body x))
let rec gen_elim_nondep_p (ty: list (Type u#a)) : Tot (curried_function_type ty (U.raise_t u#_ u#(max 2 a) unit -> vprop) -> curried_function_type ty (U.raise_t u#_ u#(max 2 a) unit -> prop) -> Tot vprop) =
match ty as ty' returns curried_function_type ty' (U.raise_t u#_ u#(max 2 a) unit -> vprop) -> curried_function_type ty' (U.raise_t u#_ u#(max 2 a) unit -> prop) -> Tot vprop with
| [] -> fun q post -> q (U.raise_val ()) `star` pure (post (U.raise_val ()))
| t :: tq -> fun q post -> exists_ (fun x -> gen_elim_nondep_p tq (q x) (post x))
let rec gen_elim_nondep_sem_correct
(ty: list (Type u#a))
: Tot ((q: curried_function_type ty _) -> (post: curried_function_type ty _) -> Lemma
(tele_p (gen_elim_nondep_sem ty q post) `equiv` gen_elim_nondep_p ty q post)
)
= match ty returns ((q: curried_function_type ty _) -> (post: curried_function_type ty _) -> Lemma
(tele_p (gen_elim_nondep_sem ty q post) `equiv` gen_elim_nondep_p ty q post)
)
with
| [] -> fun q post -> equiv_refl (q (U.raise_val ()) `star` pure (post (U.raise_val ())))
| ta :: tq -> fun q post ->
let phi
(x: ta)
: Lemma
(tele_p (gen_elim_nondep_sem tq (q x) (post x)) `equiv` gen_elim_nondep_p tq (q x) (post x))
= gen_elim_nondep_sem_correct tq (q x) (post x)
in
Classical.forall_intro phi;
let prf () : Lemma
(exists_ (fun x -> tele_p (gen_elim_nondep_sem tq (q x) (post x))) `equiv` exists_ (fun x -> gen_elim_nondep_p tq (q x) (post x)))
=
exists_equiv (fun x -> tele_p (gen_elim_nondep_sem tq (q x) (post x))) (fun x -> gen_elim_nondep_p tq (q x) (post x))
in
assert_norm (tele_p (gen_elim_nondep_sem (ta :: tq) q post) == exists_ (fun x -> tele_p (gen_elim_nondep_sem tq (q x) (post x))));
assert_norm (gen_elim_nondep_p (ta :: tq) q post == exists_ (fun x -> gen_elim_nondep_p tq (q x) (post x)));
prf ()
let compute_gen_elim_nondep_correct_t
(i0: gen_elim_i)
(ty: list (Type u#1))
: Tot Type
= (q: _) ->
(post: _) ->
(intro: vprop_rewrite (compute_gen_elim_p i0) (gen_elim_nondep_p ty q post)) ->
GTot (gen_elim_f
(compute_gen_elim_p i0)
(compute_gen_elim_nondep_a' ty)
(fun x -> compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) ty q x (U.raise_val ()))
(fun x -> compute_uncurry _ (fun _ -> True) ty post x (U.raise_val ()))
)
let compute_gen_elim_nondep_correct0
(i0: gen_elim_i)
: Tot (compute_gen_elim_nondep_correct_t i0 [])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (q (U.raise_val ()) `star` pure (post (U.raise_val ())));
let res = U.raise_val () in
elim_pure _;
rewrite_with_trefl (q (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct1
(i0: gen_elim_i)
(t1: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> q x1 (U.raise_val ()) `star` pure (post x1 (U.raise_val ()))));
let res = elim_exists' () in
elim_pure _;
rewrite_with_trefl (q _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct2
(i0: gen_elim_i)
(t1 t2: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> q x1 x2 (U.raise_val ()) `star` pure (post x1 x2 (U.raise_val ())))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let res = Mktuple2 x1 x2 in
elim_pure _;
rewrite_with_trefl (q _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct3
(i0: gen_elim_i)
(t1 t2 t3: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> q x1 x2 x3 (U.raise_val ()) `star` pure (post x1 x2 x3 (U.raise_val ()))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let res = Mktuple3 x1 x2 x3 in
elim_pure _;
rewrite_with_trefl (q _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct4
(i0: gen_elim_i)
(t1 t2 t3 t4: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> q x1 x2 x3 x4 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 (U.raise_val ())))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let res = Mktuple4 x1 x2 x3 x4 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct5
(i0: gen_elim_i)
(t1 t2 t3 t4 t5: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> q x1 x2 x3 x4 x5 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 (U.raise_val ()))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let res = Mktuple5 x1 x2 x3 x4 x5 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct6
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> q x1 x2 x3 x4 x5 x6 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 (U.raise_val ())))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let res = Mktuple6 x1 x2 x3 x4 x5 x6 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct7
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> q x1 x2 x3 x4 x5 x6 x7 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 (U.raise_val ()))))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let x7 = elim_exists' () in
let res = Mktuple7 x1 x2 x3 x4 x5 x6 x7 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct8
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7 t8: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> exists_ (fun x8 -> q x1 x2 x3 x4 x5 x6 x7 x8 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 x8 (U.raise_val ())))))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let x7 = elim_exists' () in
let x8 = elim_exists' () in
let res = Mktuple8 x1 x2 x3 x4 x5 x6 x7 x8 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct9
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7 t8 t9: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> exists_ (fun x8 -> exists_ (fun x9 -> q x1 x2 x3 x4 x5 x6 x7 x8 x9 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 x8 x9 (U.raise_val ()))))))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let x7 = elim_exists' () in
let x8 = elim_exists' () in
let x9 = elim_exists' () in
let res = Mktuple9 x1 x2 x3 x4 x5 x6 x7 x8 x9 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct10
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7 t8 t9 t10: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> exists_ (fun x8 -> exists_ (fun x9 -> exists_ (fun x10 -> q x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 (U.raise_val ())))))))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let x7 = elim_exists' () in
let x8 = elim_exists' () in
let x9 = elim_exists' () in
let x10 = elim_exists' () in
let res = Mktuple10 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct11
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> exists_ (fun x8 -> exists_ (fun x9 -> exists_ (fun x10 -> exists_ (fun x11 -> q x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 (U.raise_val ()))))))))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let x7 = elim_exists' () in
let x8 = elim_exists' () in
let x9 = elim_exists' () in
let x10 = elim_exists' () in
let x11 = elim_exists' () in
let res = Mktuple11 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct12
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> exists_ (fun x8 -> exists_ (fun x9 -> exists_ (fun x10 -> exists_ (fun x11 -> exists_ (fun x12 -> q x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 (U.raise_val ())))))))))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let x7 = elim_exists' () in
let x8 = elim_exists' () in
let x9 = elim_exists' () in
let x10 = elim_exists' () in
let x11 = elim_exists' () in
let x12 = elim_exists' () in
let res = Mktuple12 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res
let compute_gen_elim_nondep_correct13
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13: Type)
: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12; t13])
= fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> exists_ (fun x8 -> exists_ (fun x9 -> exists_ (fun x10 -> exists_ (fun x11 -> exists_ (fun x12 -> exists_ (fun x13 -> q x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 (U.raise_val ()))))))))))))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let x7 = elim_exists' () in
let x8 = elim_exists' () in
let x9 = elim_exists' () in
let x10 = elim_exists' () in
let x11 = elim_exists' () in
let x12 = elim_exists' () in
let x13 = elim_exists' () in
let res = Mktuple13 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Universe.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.GenElim1.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Universe",
"short_module": "U"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Steel.ST.GenElim1.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"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 |
i0: Steel.ST.GenElim1.Base.gen_elim_i ->
t1: Type ->
t2: Type ->
t3: Type ->
t4: Type ->
t5: Type ->
t6: Type ->
t7: Type ->
t8: Type ->
t9: Type ->
t10: Type ->
t11: Type ->
t12: Type ->
t13: Type ->
t14: Type
-> Steel.ST.GenElim1.compute_gen_elim_nondep_correct_t i0
[t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12; t13; t14] | Prims.Tot | [
"total"
] | [] | [
"Steel.ST.GenElim1.Base.gen_elim_i",
"Steel.ST.GenElim1.Base.curried_function_type",
"Prims.Cons",
"Prims.Nil",
"FStar.Universe.raise_t",
"Prims.unit",
"Steel.Effect.Common.vprop",
"Prims.prop",
"Steel.ST.GenElim1.vprop_rewrite",
"Steel.ST.GenElim1.Base.compute_gen_elim_p",
"Steel.ST.GenElim1.gen_elim_nondep_p",
"Steel.Memory.inames",
"Steel.ST.GenElim1.Base.compute_gen_elim_nondep_a'",
"Steel.ST.GenElim1.rewrite_with_trefl",
"FStar.Universe.raise_val",
"Steel.ST.GenElim1.Base.compute_uncurry",
"Steel.ST.GenElim1.Base.compute_gen_elim_p'",
"Steel.ST.Util.elim_pure",
"FStar.Pervasives.Native.tuple14",
"FStar.Pervasives.Native.Mktuple14",
"Steel.ST.GenElim1.elim_exists'",
"Steel.Effect.Common.VStar",
"Steel.ST.Util.pure",
"Steel.ST.Util.exists_",
"Steel.Effect.Common.star",
"Steel.ST.GenElim1.compute_gen_elim_nondep_correct_t"
] | [] | false | false | false | false | false | let compute_gen_elim_nondep_correct14
(i0: gen_elim_i)
(t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14: Type)
: Tot
(compute_gen_elim_nondep_correct_t i0
[t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12; t13; t14]) =
| fun q post intro _ ->
intro _;
rewrite_with_trefl (gen_elim_nondep_p _ _ _)
(exists_ (fun x1 ->
exists_ (fun x2 ->
exists_ (fun x3 ->
exists_ (fun x4 ->
exists_ (fun x5 ->
exists_ (fun x6 ->
exists_ (fun x7 ->
exists_ (fun x8 ->
exists_ (fun x9 ->
exists_ (fun x10 ->
exists_ (fun x11 ->
exists_ (fun x12 ->
exists_ (fun x13 ->
exists_ (fun
x14
->
(q x1 x2
x3 x4
x5 x6
x7 x8
x9 x10
x11
x12
x13
x14
(U.raise_val
()
))
`star`
(pure (post
x1
x2
x3
x4
x5
x6
x7
x8
x9
x10
x11
x12
x13
x14
(U.raise_val
()
))
))))))))))
))))));
let x1 = elim_exists' () in
let x2 = elim_exists' () in
let x3 = elim_exists' () in
let x4 = elim_exists' () in
let x5 = elim_exists' () in
let x6 = elim_exists' () in
let x7 = elim_exists' () in
let x8 = elim_exists' () in
let x9 = elim_exists' () in
let x10 = elim_exists' () in
let x11 = elim_exists' () in
let x12 = elim_exists' () in
let x13 = elim_exists' () in
let x14 = elim_exists' () in
let res = Mktuple14 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 in
elim_pure _;
rewrite_with_trefl (q _ _ _ _ _ _ _ _ _ _ _ _ _ _ (U.raise_val ()))
(compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));
res | false |
Steel.ST.Printf.fst | Steel.ST.Printf.print_frag | val print_frag (hd: frag_t) : STT unit (live_frag hd) (fun _ -> live_frag hd) | val print_frag (hd: frag_t) : STT unit (live_frag hd) (fun _ -> live_frag hd) | let print_frag (hd: frag_t) : STT unit (live_frag hd) (fun _ -> live_frag hd)
=
(match hd with
| Inl s -> print_string s
| Inr (| Base t, Lift value |) ->
(match t with
| Bool -> print_bool value
| Char -> print_char value
| String -> print_string value
| U8 -> print_u8 value
| U16 -> print_u16 value
| U32 -> print_u32 value
| U64 -> print_u64 value
| I8 -> print_i8 value
| I16 -> print_i16 value
| I32 -> print_i32 value
| I64 -> print_i64 value)
| Inr (| Array t, Lift ((| l, value |), p, v ) |) ->
(match t with
| Bool -> print_lmbuffer_gen print_lmbuffer_bool l value p v
| Char -> print_lmbuffer_gen print_lmbuffer_char l value p v
| String -> print_lmbuffer_gen print_lmbuffer_string l value p v
| U8 -> print_lmbuffer_gen print_lmbuffer_u8 l value p v
| U16 -> print_lmbuffer_gen print_lmbuffer_u16 l value p v
| U32 -> print_lmbuffer_gen print_lmbuffer_u32 l value p v
| U64 -> print_lmbuffer_gen print_lmbuffer_u64 l value p v
| I8 -> print_lmbuffer_gen print_lmbuffer_i8 l value p v
| I16 -> print_lmbuffer_gen print_lmbuffer_i16 l value p v
| I32 -> print_lmbuffer_gen print_lmbuffer_i32 l value p v
| I64 -> print_lmbuffer_gen print_lmbuffer_i64 l value p v
)
| Inr (| Any, (| _, printer, value |) |) ->
printer value) | {
"file_name": "lib/steel/Steel.ST.Printf.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 23,
"end_line": 424,
"start_col": 0,
"start_line": 392
} | (*
Copyright 2008-2022 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.ST.Printf
/// This module provides Steel.ST imperative printing functions for several
/// primitive Low* types, including
/// -- booleans (%b)
/// -- characters (%c)
/// -- strings (%s)
/// -- machine integers
/// (UInt8.t as %uy, UInt16.t as %us, UInt32.t as %ul, and UInt64.t as %uL;
/// Int8.t as %y, Int16.t as %i, Int32.t as %l , and Int64.t as %L)
/// -- and arrays of these base types formatted
/// as %xN, where N is the format specifier for the array element type
/// e.g., %xuy for buffers of UInt8.t
/// The main function of this module is `printf`
/// There are a few main differences relative to C printf
/// -- The format specifiers are different (see above)
///
/// -- For technical reasons explained below, an extra dummy
/// argument `done` has to be provided at the end for the
/// computation to have any effect.
///
/// E.g., one must write
/// `printf "%b %c" true 'c' done`
/// rather than just
/// `printf "%b %c" true 'c'`
///
/// -- When printing arrays, two arguments must be passed; the
/// length of the array fragment to be formatted and the array
/// itself
///
/// -- When extracted, rather than producing a C `printf` (which
/// does not, e.g., support printing of dynamically sized
/// arrays), our `printf` is specialized to a sequence of calls
/// to primitive printers for each supported type
///
/// Before diving into the technical details of how this module works,
/// you might want to see a sample usage at the very end of this file.
open FStar.Char
open FStar.String
open Steel.ST.Util
module L = FStar.List.Tot
module A = Steel.ST.Array
module U32 = FStar.UInt32
#set-options "--ide_id_info_off"
/// `lmbuffer a l` is
/// - an array of `a`
/// - governed by preorders `r` and `s`
/// - with length `l`
inline_for_extraction
let lmbuffer a l =
b: A.array a {
A.length b == U32.v l
}
/// `StTrivial`: A effect abbreviation for a stateful computation
/// with no precondition, and which does not read or change the state
effect StTrivial (a:Type) =
STT a emp (fun _ -> emp)
/// `StBuf a b`: A effect abbreviation for a stateful computation
/// that may read `b` but does not change the state
///
/// NOTE: I need to provide those primitives operating on
/// Steel.ST.Array.ptr instead of Steel.ST.Array.array, otherwise
/// Karamel will complain about arity mismatch
inline_for_extraction
let stBuf (t:Type) : Type =
(l: U32.t) ->
(p: Ghost.erased (lmbuffer t l & perm)) ->
(x: Ghost.erased (Seq.seq t)) ->
(b: A.ptr t) ->
ST unit
(A.pts_to (fst p) (snd p) x)
(fun _ -> A.pts_to (fst p) (snd p) x)
(A.ptr_of (fst p) == b)
(fun _ -> True)
/// Primitive printers for all the types supported by this module
assume val print_string: string -> StTrivial unit
assume val print_char : char -> StTrivial unit
assume val print_u8 : UInt8.t -> StTrivial unit
assume val print_u16 : UInt16.t -> StTrivial unit
assume val print_u32 : UInt32.t -> StTrivial unit
assume val print_u64 : UInt64.t -> StTrivial unit
assume val print_i8 : Int8.t -> StTrivial unit
assume val print_i16 : Int16.t -> StTrivial unit
assume val print_i32 : Int32.t -> StTrivial unit
assume val print_i64 : Int64.t -> StTrivial unit
assume val print_bool : bool -> StTrivial unit
assume val print_lmbuffer_bool : stBuf bool
assume val print_lmbuffer_char : stBuf char
assume val print_lmbuffer_string : stBuf string
assume val print_lmbuffer_u8 : stBuf UInt8.t
assume val print_lmbuffer_u16 : stBuf UInt16.t
assume val print_lmbuffer_u32 : stBuf UInt32.t
assume val print_lmbuffer_u64 : stBuf UInt64.t
assume val print_lmbuffer_i8 : stBuf Int8.t
assume val print_lmbuffer_i16 : stBuf Int16.t
assume val print_lmbuffer_i32 : stBuf Int32.t
assume val print_lmbuffer_i64 : stBuf Int64.t
/// An attribute to control reduction
noextract irreducible
let __printf_reduce__ = unit
/// Base types supported so far
noextract
type base_typ =
| Bool
| Char
| String
| U8
| U16
| U32
| U64
| I8
| I16
| I32
| I64
/// Argument types are base types and arrays thereof
/// Or polymorphic arguments specified by "%a"
noextract
type arg =
| Base of base_typ
| Array of base_typ
| Any
/// Interpreting a `base_typ` as a type
[@@__printf_reduce__]
noextract
let base_typ_as_type (b:base_typ) : Type0 =
match b with
| Bool -> bool
| Char -> char
| String -> string
| U8 -> FStar.UInt8.t
| U16 -> FStar.UInt16.t
| U32 -> FStar.UInt32.t
| U64 -> FStar.UInt64.t
| I8 -> FStar.Int8.t
| I16 -> FStar.Int16.t
| I32 -> FStar.Int32.t
| I64 -> FStar.Int64.t
/// `fragment`: A format string is parsed into a list of fragments of
/// string literals and other arguments that need to be spliced in
/// (interpolated)
noextract
type fragment =
| Frag of string
| Interpolate of arg
noextract
let fragments = list fragment
/// `parse_format s`:
/// Parses a list of characters in a format string into a list of fragments
/// Or None, in case the format string is invalid
[@@__printf_reduce__]
noextract inline_for_extraction
let rec parse_format
(s:list char)
: Tot (option fragments)
(decreases (L.length s))
= let add_dir (d:arg) (ods : option fragments)
= match ods with
| None -> None
| Some ds -> Some (Interpolate d::ds)
in
let head_buffer (ods:option fragments)
= match ods with
| Some (Interpolate (Base t) :: rest) -> Some (Interpolate (Array t) :: rest)
| _ -> None
in
let cons_frag (c:char) (ods:option fragments)
= match ods with
| Some (Frag s::rest) -> Some (Frag (string_of_list (c :: list_of_string s)) :: rest)
| Some rest -> Some (Frag (string_of_list [c]) :: rest)
| _ -> None
in
match s with
| [] -> Some []
| ['%'] -> None
// %a... polymorphic arguments and preceded by their printers
| '%' :: 'a' :: s' ->
add_dir Any (parse_format s')
// %x... arrays of base types
| '%' :: 'x' :: s' ->
head_buffer (parse_format ('%' :: s'))
// %u ... Unsigned integers
| '%' :: 'u' :: s' -> begin
match s' with
| 'y' :: s'' -> add_dir (Base U8) (parse_format s'')
| 's' :: s'' -> add_dir (Base U16) (parse_format s'')
| 'l' :: s'' -> add_dir (Base U32) (parse_format s'')
| 'L' :: s'' -> add_dir (Base U64) (parse_format s'')
| _ -> None
end
| '%' :: c :: s' -> begin
match c with
| '%' -> cons_frag '%' (parse_format s')
| 'b' -> add_dir (Base Bool) (parse_format s')
| 'c' -> add_dir (Base Char) (parse_format s')
| 's' -> add_dir (Base String) (parse_format s')
| 'y' -> add_dir (Base I8) (parse_format s')
| 'i' -> add_dir (Base I16) (parse_format s')
| 'l' -> add_dir (Base I32) (parse_format s')
| 'L' -> add_dir (Base I64) (parse_format s')
| _ -> None
end
| c :: s' ->
cons_frag c (parse_format s')
/// `parse_format_string`: a wrapper around `parse_format`
[@@__printf_reduce__]
noextract inline_for_extraction
let parse_format_string
(s:string)
: option fragments
= parse_format (list_of_string s)
/// `lift a` lifts the type `a` to a higher universe
noextract
type lift (a:Type u#a) : Type u#(max a b) =
| Lift : a -> lift a
/// `done` is a `unit` in universe 1
noextract
let done : lift unit = Lift u#0 u#1 ()
/// `arg_t`: interpreting an argument as a type
/// (in universe 1) since it is polymorphic in the argument type of Any (%a) printers.
/// GM: Somehow, this needs to be a `let rec` (even if it not really recursive)
/// or print_frags fails to verify. I don't know why; the generated
/// VC and its encoding seem identical (modulo hash consing in the
/// latter).
[@@__printf_reduce__]
noextract
let rec arg_t (a:arg) : Type u#1 =
match a with
| Base t -> lift (base_typ_as_type t)
| Array t -> lift ((l:UInt32.t & lmbuffer (base_typ_as_type t) l) & perm & Ghost.erased (Seq.seq (base_typ_as_type t)))
| Any -> (a:Type0 & (a -> StTrivial unit) & a)
/// `frag_t`: a fragment is either a string literal or a argument to be interpolated
noextract
let frag_t = either string (a:arg & arg_t a)
/// `live_frags h l` is a separation logic predicate asserting ownership of all the arrays in `l`
[@@__printf_reduce__; Steel.Effect.Common.__reduce__]
noextract
let live_frag0 (f: frag_t) : vprop =
match f with
| Inl _ -> emp
| Inr a ->
(match a with
| (| Base _, _ |) -> emp
| (| Any, _ |) -> emp
| (| Array _, Lift ((| _, b |), p, v) |) -> A.pts_to b p v)
[@@__printf_reduce__]
noextract
let live_frag (f: frag_t) : vprop =
live_frag0 f
[@@__printf_reduce__]
noextract
let rec live_frags (l:list frag_t) : vprop =
match l with
| [] -> emp
| a :: q -> live_frag a `star` live_frags q
/// `interpret_frags` interprets a list of fragments as a Steel.ST function type
/// Note `l` is the fragments in L-to-R order (i.e., parsing order)
/// `acc` accumulates the fragment values in reverse order
[@@__printf_reduce__]
noextract
let rec interpret_frags (l:fragments) (acc: list frag_t) : Type u#1 =
match l with
| [] ->
// Always a dummy argument at the end
// Ensures that all cases of this match
// have the same universe, i.e., u#1
lift u#0 u#1 unit
-> STT unit (live_frags acc) (fun _ -> live_frags acc)
| Interpolate (Base t) :: args ->
// Base types are simple: we just take one more argument
x:base_typ_as_type t ->
interpret_frags args (Inr (| Base t, Lift x |) :: acc)
| Interpolate (Array t) :: args ->
// Arrays are implicitly polymorphic in their preorders `r` and `s`
// which is what forces us to be in universe 1
// Note, the length `l` is explicit
l:UInt32.t ->
#p:perm ->
#v:Ghost.erased (Seq.seq (base_typ_as_type t)) ->
b:lmbuffer (base_typ_as_type t) l ->
interpret_frags args (Inr (| Array t, Lift ((| l, b |), p, v) |) :: acc)
| Interpolate Any :: args ->
#a:Type0 ->
p:(a -> StTrivial unit) ->
x:a ->
interpret_frags args (Inr (| Any, (| a, p, x |) |) :: acc)
| Frag s :: args ->
// Literal fragments do not incur an additional argument
// We just accumulate them and recur
interpret_frags args (Inl s :: acc)
/// `normal` A normalization marker with very specific steps enabled
noextract unfold
let normal (#a:Type) (x:a) : a =
FStar.Pervasives.norm
[iota;
zeta;
delta_attr [`%__printf_reduce__; `%BigOps.__reduce__];
delta_only [`%Base?; `%Array?; `%Some?; `%Some?.v; `%list_of_string];
primops;
simplify]
x
/// `coerce`: A utility to trigger extensional equality of types
noextract
let coerce (x:'a{'a == 'b}) : 'b = x
/// `fragment_printer`: The type of a printer of fragments
noextract
let fragment_printer =
(acc:list frag_t)
-> STT unit (live_frags acc) (fun _ -> live_frags acc)
/// `print_frags`: Having accumulated all the pieces of a format
/// string and the arguments to the printed (i.e., the `list frag_t`),
/// this function does the actual work of printing them all using the
/// primitive printers
noextract inline_for_extraction
let print_lmbuffer_gen
(#t: Type)
(#fr: frag_t)
(f: stBuf t)
(l: U32.t)
(#tb: Type)
(b: tb)
(p: perm)
(#tv: Type)
(v: tv)
: ST unit (live_frag fr) (fun _ -> live_frag fr)
(tb == lmbuffer t l /\
tv == Ghost.erased (Seq.seq t) /\
live_frag fr == A.pts_to #t (coerce #_ #(lmbuffer t l) b) p (coerce #_ #(Ghost.erased (Seq.seq t)) v))
(fun _ -> True)
= [@inline_let] let b' : lmbuffer t l = coerce b in
let v' : Ghost.erased (Seq.seq t) = coerce v in
let p' : Ghost.erased (lmbuffer t l & perm) = Ghost.hide (b', p) in
rewrite (live_frag fr) (A.pts_to #t (fst p') (snd p') v');
f l _ _ (A.ptr_of b');
rewrite (A.pts_to _ _ _) (live_frag fr) | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Util.fsti.checked",
"Steel.ST.Array.fsti.checked",
"Steel.Effect.Common.fsti.checked",
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.String.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Int8.fsti.checked",
"FStar.Int64.fsti.checked",
"FStar.Int32.fsti.checked",
"FStar.Int16.fsti.checked",
"FStar.Ghost.fsti.checked",
"FStar.Char.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Steel.ST.Printf.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "Steel.ST.Array",
"short_module": "A"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.String",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Char",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"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 | hd: Steel.ST.Printf.frag_t -> Steel.ST.Effect.STT Prims.unit | Steel.ST.Effect.STT | [] | [] | [
"Steel.ST.Printf.frag_t",
"Prims.string",
"Steel.ST.Printf.print_string",
"Prims.unit",
"Steel.ST.Printf.base_typ",
"Steel.ST.Printf.base_typ_as_type",
"Steel.ST.Printf.print_bool",
"Steel.ST.Printf.print_char",
"Steel.ST.Printf.print_u8",
"Steel.ST.Printf.print_u16",
"Steel.ST.Printf.print_u32",
"Steel.ST.Printf.print_u64",
"Steel.ST.Printf.print_i8",
"Steel.ST.Printf.print_i16",
"Steel.ST.Printf.print_i32",
"Steel.ST.Printf.print_i64",
"FStar.UInt32.t",
"Steel.ST.Printf.lmbuffer",
"Steel.FractionalPermission.perm",
"FStar.Ghost.erased",
"FStar.Seq.Base.seq",
"Steel.ST.Printf.print_lmbuffer_gen",
"Prims.bool",
"Steel.ST.Printf.print_lmbuffer_bool",
"FStar.String.char",
"Steel.ST.Printf.print_lmbuffer_char",
"Steel.ST.Printf.print_lmbuffer_string",
"FStar.UInt8.t",
"Steel.ST.Printf.print_lmbuffer_u8",
"FStar.UInt16.t",
"Steel.ST.Printf.print_lmbuffer_u16",
"Steel.ST.Printf.print_lmbuffer_u32",
"FStar.UInt64.t",
"Steel.ST.Printf.print_lmbuffer_u64",
"FStar.Int8.t",
"Steel.ST.Printf.print_lmbuffer_i8",
"FStar.Int16.t",
"Steel.ST.Printf.print_lmbuffer_i16",
"FStar.Int32.t",
"Steel.ST.Printf.print_lmbuffer_i32",
"FStar.Int64.t",
"Steel.ST.Printf.print_lmbuffer_i64",
"Steel.ST.Printf.live_frag",
"Steel.Effect.Common.vprop"
] | [] | false | true | false | false | false | let print_frag (hd: frag_t) : STT unit (live_frag hd) (fun _ -> live_frag hd) =
| (match hd with
| Inl s -> print_string s
| Inr (| Base t , Lift value |) ->
(match t with
| Bool -> print_bool value
| Char -> print_char value
| String -> print_string value
| U8 -> print_u8 value
| U16 -> print_u16 value
| U32 -> print_u32 value
| U64 -> print_u64 value
| I8 -> print_i8 value
| I16 -> print_i16 value
| I32 -> print_i32 value
| I64 -> print_i64 value)
| Inr (| Array t , Lift ((| l , value |), p, v) |) ->
(match t with
| Bool -> print_lmbuffer_gen print_lmbuffer_bool l value p v
| Char -> print_lmbuffer_gen print_lmbuffer_char l value p v
| String -> print_lmbuffer_gen print_lmbuffer_string l value p v
| U8 -> print_lmbuffer_gen print_lmbuffer_u8 l value p v
| U16 -> print_lmbuffer_gen print_lmbuffer_u16 l value p v
| U32 -> print_lmbuffer_gen print_lmbuffer_u32 l value p v
| U64 -> print_lmbuffer_gen print_lmbuffer_u64 l value p v
| I8 -> print_lmbuffer_gen print_lmbuffer_i8 l value p v
| I16 -> print_lmbuffer_gen print_lmbuffer_i16 l value p v
| I32 -> print_lmbuffer_gen print_lmbuffer_i32 l value p v
| I64 -> print_lmbuffer_gen print_lmbuffer_i64 l value p v)
| Inr (| Any , (| _ , printer , value |) |) -> printer value) | false |
HaclExample2.fst | HaclExample2.test | val test (#v: Ghost.erased (typeof comp)) (p: ref comp)
: ST (Ghost.erased (typeof comp))
(p `pts_to` v)
(fun v' -> p `pts_to` v')
(full comp v)
(fun v' -> full comp v') | val test (#v: Ghost.erased (typeof comp)) (p: ref comp)
: ST (Ghost.erased (typeof comp))
(p `pts_to` v)
(fun v' -> p `pts_to` v')
(full comp v)
(fun v' -> full comp v') | let test
(#v: Ghost.erased (typeof comp))
(p: ref comp)
: ST (Ghost.erased (typeof comp))
(p `pts_to` v)
(fun v' -> p `pts_to` v')
(full comp v)
(fun v' -> full comp v')
= let q = struct_field p "limbs" #_ #(base_array0 five (scalar U64.t) 5sz) () in
let a = array_of_base q in
let r = struct_field p "precomp" #_ #(base_array0 twenty (scalar U64.t) 20sz) () in
let _ = vpattern_replace (pts_to p) in // FIXME: WHY WHY WHY?
let b = array_of_base r in
let _ = do_something_with_limbs a in
let _ = do_something_with_precomp b in
let _ = gen_elim () in
let _ = unarray_of_base q a in
let _ = unarray_of_base r b in
let _ = unstruct_field_alt p "precomp" r in
let _ = unstruct_field_alt p "limbs" q in
drop (has_struct_field p "limbs" q);
drop (has_struct_field p "precomp" r);
return _ | {
"file_name": "share/steel/examples/steelc/HaclExample2.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 10,
"end_line": 127,
"start_col": 0,
"start_line": 105
} | module HaclExample2
open Steel.ST.GenElim
open Steel.ST.C.Types
open Steel.C.Typenat
open Steel.C.Typestring
module SZ = FStar.SizeT
module U64 = FStar.UInt64
(** In this file we demonstrate how Steel could be used to manipulate the following data type used in Hacl*:
https://github.com/project-everest/hacl-star/blob/master/code/poly1305/Hacl.Impl.Poly1305.fsti#L18
This Low* definition amounts to the struct definition
struct poly1305_ctx { uint64_t limbs[5]; uint64_t precomp[20]; };
and, with our new model of structs and arrays and pointer-to-field, can be expresesd directly in Steel.
See PointStruct.fst for more detailed explanations of the various definitions needed below.
*)
noextract inline_for_extraction let five = normalize (nat_t_of_nat 5)
noextract inline_for_extraction let twenty = normalize (nat_t_of_nat 20)
noextract inline_for_extraction let comp_name = normalize (mk_string_t "HaclExample2.comp")
noextract
inline_for_extraction
[@@norm_field_attr]
let comp_fields =
field_description_cons "limbs" (base_array0 five (scalar U64.t) 5sz) (
field_description_cons "precomp" (base_array0 twenty (scalar U64.t) 20sz) (
field_description_nil
))
noextract inline_for_extraction
let comp = struct0 comp_name "HaclExample2.comp" comp_fields
let _ = define_struct0 comp_name "HaclExample2.comp" comp_fields
(** To demonstrate how our model could be used, we write a simple
function that takes pointers to the limbs and precomp fields and
passes them to helper functions (which in this case simply set on
element of the corresponding array to zero) *)
let do_something_with_limbs
(#v: Ghost.erased (Seq.seq (scalar_t U64.t)))
(a: array (scalar U64.t))
: ST (Ghost.erased (Seq.seq (scalar_t U64.t)))
(array_pts_to a v)
(fun v' -> array_pts_to a v')
(requires
array_length a == 5 /\
full_seq (scalar U64.t) v
)
(ensures (fun v' ->
full_seq (scalar U64.t) v'
))
= let p = array_cell a 2sz in
write p 0uL;
unarray_cell _ _ _;
drop (has_array_cell _ _ _);
return _
let do_something_with_precomp
(#v: Ghost.erased (Seq.seq (scalar_t U64.t)))
(a: array (scalar U64.t))
: ST (ptr (scalar U64.t))
(array_pts_to a v)
(fun _ -> exists_ (fun (v': Seq.seq (scalar_t U64.t)) ->
array_pts_to a v' `star`
pure (full_seq (scalar U64.t) v')
))
(requires
array_length a == 20 /\
full_seq (scalar U64.t) v
)
(ensures fun _ -> True)
= let p = array_cell a 19sz in
write p 0uL;
unarray_cell _ _ _;
drop (has_array_cell _ _ _);
noop ();
return (null _)
let test_alloc_free
()
: STT unit
emp
(fun _ -> emp)
=
let a = array_alloc (scalar bool) 42sz in
let _ = gen_elim () in
if array_is_null a
then begin
rewrite (array_pts_to_or_null _ _) emp;
rewrite (freeable_or_null_array _) emp;
noop ()
end else begin
let s = vpattern_replace (array_pts_to_or_null _) in
rewrite (array_pts_to_or_null _ _) (array_pts_to a s);
rewrite (freeable_or_null_array _) (freeable_array a);
array_free a
end
#push-options "--fuel 0 --print_universes --print_implicits --z3rlimit 128"
#restart-solver | {
"checked_file": "/",
"dependencies": [
"Steel.ST.GenElim.fsti.checked",
"Steel.ST.C.Types.fst.checked",
"Steel.C.Typestring.fsti.checked",
"Steel.C.Typenat.fsti.checked",
"prims.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.SizeT.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "HaclExample2.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.SizeT",
"short_module": "SZ"
},
{
"abbrev": false,
"full_module": "Steel.C.Typestring",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.C.Typenat",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.C.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.GenElim",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": 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": 1,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 128,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | p: Steel.ST.C.Types.Base.ref HaclExample2.comp
-> Steel.ST.Effect.ST (FStar.Ghost.erased (Steel.ST.C.Types.Base.typeof HaclExample2.comp)) | Steel.ST.Effect.ST | [] | [] | [
"FStar.Ghost.erased",
"Steel.ST.C.Types.Base.typeof",
"Steel.ST.C.Types.Struct.struct_t0",
"HaclExample2.comp_name",
"Steel.ST.C.Types.Fields.field_t_cons",
"Steel.C.Typestring.string_cons",
"Steel.C.Typestring.cl",
"Steel.C.Typestring.ci",
"Steel.C.Typestring.cm",
"Steel.C.Typestring.cb",
"Steel.C.Typestring.cs",
"Steel.C.Typestring.string_nil",
"Steel.ST.C.Types.Array.base_array_t",
"Steel.ST.C.Types.Scalar.scalar_t",
"FStar.UInt64.t",
"HaclExample2.five",
"FStar.SizeT.__uint_to_t",
"Steel.C.Typestring.cp",
"Steel.C.Typestring.cr",
"Steel.C.Typestring.ce",
"Steel.C.Typestring.cc",
"Steel.C.Typestring.co",
"HaclExample2.twenty",
"Steel.ST.C.Types.Fields.field_t_nil",
"HaclExample2.comp_fields",
"HaclExample2.comp",
"Steel.ST.C.Types.Base.ref",
"Steel.ST.Util.return",
"FStar.Ghost.hide",
"FStar.Set.set",
"Steel.Memory.iname",
"FStar.Set.empty",
"Steel.ST.C.Types.Base.pts_to",
"Steel.Effect.Common.vprop",
"Prims.unit",
"Steel.ST.Util.drop",
"Steel.ST.C.Types.Struct.has_struct_field",
"Steel.ST.C.Types.Array.base_array0",
"Steel.ST.C.Types.Scalar.scalar",
"FStar.SizeT.uint_to_t",
"FStar.SizeT.t",
"Steel.ST.C.Types.Struct.unstruct_field_alt",
"Steel.ST.C.Types.Array.unarray_of_base",
"FStar.Seq.Base.seq",
"FStar.Ghost.reveal",
"Steel.ST.GenElim.gen_elim",
"Steel.Effect.Common.VStar",
"Steel.ST.C.Types.Array.array_pts_to",
"Steel.ST.Util.exists_",
"Steel.ST.Util.pure",
"Steel.ST.C.Types.Array.full_seq",
"Steel.Effect.Common.star",
"Steel.Effect.Common.emp",
"Prims.l_and",
"Prims.l_True",
"Prims.prop",
"Steel.ST.C.Types.Base.ptr",
"HaclExample2.do_something_with_precomp",
"Steel.ST.C.Types.Array.seq_of_base_array",
"Steel.ST.C.Types.Struct.struct_get_field",
"Steel.ST.C.Types.Struct.struct_set_field",
"Steel.ST.C.Types.Base.unknown",
"Steel.ST.C.Types.Fields.__proj__Mkfield_description_t__item__fd_type",
"Steel.ST.C.Types.Fields.__proj__Mkfield_description_t__item__fd_typedef",
"HaclExample2.do_something_with_limbs",
"Steel.ST.C.Types.Array.array",
"Steel.ST.C.Types.Array.has_array_of_base",
"Steel.ST.C.Types.Array.array_size_t",
"Steel.ST.C.Types.Array.array_of_base",
"Steel.ST.Util.vpattern_replace",
"Steel.ST.C.Types.Struct.struct_field",
"Steel.ST.C.Types.Base.full"
] | [] | false | true | false | false | false | let test (#v: Ghost.erased (typeof comp)) (p: ref comp)
: ST (Ghost.erased (typeof comp))
(p `pts_to` v)
(fun v' -> p `pts_to` v')
(full comp v)
(fun v' -> full comp v') =
| let q = struct_field p "limbs" #_ #(base_array0 five (scalar U64.t) 5sz) () in
let a = array_of_base q in
let r = struct_field p "precomp" #_ #(base_array0 twenty (scalar U64.t) 20sz) () in
let _ = vpattern_replace (pts_to p) in
let b = array_of_base r in
let _ = do_something_with_limbs a in
let _ = do_something_with_precomp b in
let _ = gen_elim () in
let _ = unarray_of_base q a in
let _ = unarray_of_base r b in
let _ = unstruct_field_alt p "precomp" r in
let _ = unstruct_field_alt p "limbs" q in
drop (has_struct_field p "limbs" q);
drop (has_struct_field p "precomp" r);
return _ | false |