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