val eCCurve_valid (h:HS.mem) (#rrel: _) (#rel: _) (input:LL.slice rrel rel) (pos0:U32.t) : Lemma
  (requires (
  LL.valid eCCurve_a_parser h input pos0 /\ (
  let pos1 = LL.get_valid_pos eCCurve_a_parser h input pos0 in
  LL.valid eCCurve_b_parser h input pos1 /\ (
  let pos2 = LL.get_valid_pos eCCurve_b_parser h input pos1 in
  True
  ))))
  (ensures (
  let a = LL.contents eCCurve_a_parser h input pos0 in
  let pos1 = LL.get_valid_pos eCCurve_a_parser h input pos0 in
  let b = LL.contents eCCurve_b_parser h input pos1 in
  let pos2 = LL.get_valid_pos eCCurve_b_parser h input pos1 in
  LL.valid_content_pos eCCurve_parser h input pos0 ({
      a = a;
      b = b;
    }) pos2))
val eCCurve_valid (h:HS.mem) (#rrel: _) (#rel: _) (input:LL.slice rrel rel) (pos0:U32.t) : Lemma
  (requires (
  LL.valid eCCurve_a_parser h input pos0 /\ (
  let pos1 = LL.get_valid_pos eCCurve_a_parser h input pos0 in
  LL.valid eCCurve_b_parser h input pos1 /\ (
  let pos2 = LL.get_valid_pos eCCurve_b_parser h input pos1 in
  True
  ))))
  (ensures (
  let a = LL.contents eCCurve_a_parser h input pos0 in
  let pos1 = LL.get_valid_pos eCCurve_a_parser h input pos0 in
  let b = LL.contents eCCurve_b_parser h input pos1 in
  let pos2 = LL.get_valid_pos eCCurve_b_parser h input pos1 in
  LL.valid_content_pos eCCurve_parser h input pos0 ({
      a = a;
      b = b;
    }) pos2))
let eCCurve_valid h #_ #_ input pos0 =
  let a = LL.contents eCCurve_a_parser h input pos0 in
  let pos1 = LL.get_valid_pos eCCurve_a_parser h input pos0 in
  let b = LL.contents eCCurve_b_parser h input pos1 in
  let pos2 = LL.get_valid_pos eCCurve_b_parser h input pos1 in
  LL.valid_nondep_then_intro h eCCurve_a_parser eCCurve_b_parser input pos0;
  assert_norm (eCCurve' == LP.get_parser_type eCCurve'_parser);
  assert_norm (eCCurve_parser_kind == eCCurve'_parser_kind);
  synth_eCCurve_injective ();
  LL.valid_synth_intro h eCCurve'_parser synth_eCCurve input pos0
module MiTLS.Parsers.ECCurve

(* This file has been automatically generated by EverParse. *)
open FStar.Bytes
module U8 = FStar.UInt8
module U16 = FStar.UInt16
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module LP = LowParse.Spec
module LT = LowParse.TacLib
module LS = LowParse.SLow
module LSZ = LowParse.SLow
module LPI = LowParse.Spec.AllIntegers
module LL = LowParse.Low
module L = FStar.List.Tot
module B = LowStar.Buffer
module BY = FStar.Bytes
module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST

#reset-options "--using_facts_from '* -FStar.Tactics -FStar.Reflection' --z3rlimit 16 --z3cliopt smt.arith.nl=false --max_fuel 2 --max_ifuel 2"

(* Type of field a*)
open MiTLS.Parsers.ECCurve_a

(* Type of field b*)
open MiTLS.Parsers.ECCurve_b

type eCCurve' = (eCCurve_a & eCCurve_b)

inline_for_extraction let synth_eCCurve (x: eCCurve') : eCCurve =
  match x with (a,b) -> {
    a = a;
    b = b;
  }

inline_for_extraction let synth_eCCurve_recip (x: eCCurve) : eCCurve' = (x.a,x.b)

let synth_eCCurve_recip_inverse () : Lemma (LP.synth_inverse synth_eCCurve_recip synth_eCCurve) = ()

let synth_eCCurve_injective () : Lemma (LP.synth_injective synth_eCCurve) =
  LP.synth_inverse_synth_injective synth_eCCurve_recip synth_eCCurve;
  synth_eCCurve_recip_inverse ()

let synth_eCCurve_inverse () : Lemma (LP.synth_inverse synth_eCCurve synth_eCCurve_recip) =
  assert_norm (LP.synth_inverse synth_eCCurve synth_eCCurve_recip)

let synth_eCCurve_recip_injective () : Lemma (LP.synth_injective synth_eCCurve_recip) =
  synth_eCCurve_recip_inverse ();
  LP.synth_inverse_synth_injective synth_eCCurve synth_eCCurve_recip

noextract let eCCurve'_parser : LP.parser _ eCCurve' = (eCCurve_a_parser `LP.nondep_then` eCCurve_b_parser)

noextract let eCCurve'_parser_kind = LP.get_parser_kind eCCurve'_parser

let eCCurve_parser =
  synth_eCCurve_injective ();
  assert_norm (eCCurve_parser_kind == eCCurve'_parser_kind);
  eCCurve'_parser `LP.parse_synth` synth_eCCurve

noextract let eCCurve'_serializer : LP.serializer eCCurve'_parser = (eCCurve_a_serializer `LP.serialize_nondep_then` eCCurve_b_serializer)

let eCCurve_serializer =
  [@inline_let] let _ = synth_eCCurve_injective () in
  [@inline_let] let _ = synth_eCCurve_inverse () in
  [@inline_let] let _ = assert_norm (eCCurve_parser_kind == eCCurve'_parser_kind) in
  LP.serialize_synth _ synth_eCCurve eCCurve'_serializer synth_eCCurve_recip ()

let eCCurve_bytesize (x:eCCurve) : GTot nat = Seq.length (eCCurve_serializer x)

let eCCurve_bytesize_eq x = ()

inline_for_extraction let eCCurve'_parser32 : LS.parser32 eCCurve'_parser = (eCCurve_a_parser32 `LS.parse32_nondep_then` eCCurve_b_parser32)

let eCCurve_parser32 =
  [@inline_let] let _ = synth_eCCurve_injective () in
  [@inline_let] let _ = assert_norm (eCCurve_parser_kind == eCCurve'_parser_kind) in
  LS.parse32_synth _ synth_eCCurve (fun x -> synth_eCCurve x) eCCurve'_parser32 ()

inline_for_extraction let eCCurve'_serializer32 : LS.serializer32 eCCurve'_serializer = (eCCurve_a_serializer32 `LS.serialize32_nondep_then` eCCurve_b_serializer32)

let eCCurve_serializer32 =
  [@inline_let] let _ = synth_eCCurve_injective () in
  [@inline_let] let _ = synth_eCCurve_inverse () in
  [@inline_let] let _ = assert_norm (eCCurve_parser_kind == eCCurve'_parser_kind) in
  LS.serialize32_synth _ synth_eCCurve _ eCCurve'_serializer32 synth_eCCurve_recip (fun x -> synth_eCCurve_recip x) ()

inline_for_extraction let eCCurve'_size32 : LSZ.size32 eCCurve'_serializer = (eCCurve_a_size32 `LSZ.size32_nondep_then` eCCurve_b_size32)

let eCCurve_size32 =
  [@inline_let] let _ = synth_eCCurve_injective () in
  [@inline_let] let _ = synth_eCCurve_inverse () in
  [@inline_let] let _ = assert_norm (eCCurve_parser_kind == eCCurve'_parser_kind) in
  LSZ.size32_synth _ synth_eCCurve _ eCCurve'_size32 synth_eCCurve_recip (fun x -> synth_eCCurve_recip x) ()

inline_for_extraction let eCCurve'_validator : LL.validator eCCurve'_parser = (eCCurve_a_validator `LL.validate_nondep_then` eCCurve_b_validator)

let eCCurve_validator =
  [@inline_let] let _ = synth_eCCurve_injective () in
  [@inline_let] let _ = assert_norm (eCCurve_parser_kind == eCCurve'_parser_kind) in
  LL.validate_synth eCCurve'_validator synth_eCCurve ()

inline_for_extraction let eCCurve'_jumper : LL.jumper eCCurve'_parser = (eCCurve_a_jumper `LL.jump_nondep_then` eCCurve_b_jumper)

let eCCurve_jumper =
  [@inline_let] let _ = synth_eCCurve_injective () in
  [@inline_let] let _ = assert_norm (eCCurve_parser_kind == eCCurve'_parser_kind) in
  LL.jump_synth eCCurve'_jumper synth_eCCurve ()

let eCCurve_bytesize_eqn x =
  [@inline_let] let _ = synth_eCCurve_injective () in
  [@inline_let] let _ = synth_eCCurve_inverse () in
  [@inline_let] let _ = assert_norm (eCCurve_parser_kind == eCCurve'_parser_kind) in
  LP.serialize_synth_eq _ synth_eCCurve eCCurve'_serializer synth_eCCurve_recip () x;
LP.length_serialize_nondep_then eCCurve_a_serializer eCCurve_b_serializer x.a x.b;
  (eCCurve_a_bytesize_eq (x.a));
  (eCCurve_b_bytesize_eq (x.b));
  assert(eCCurve_bytesize x == Seq.length (LP.serialize eCCurve_a_serializer x.a) + Seq.length (LP.serialize eCCurve_b_serializer x.b))

let gaccessor'_eCCurve_a : LL.gaccessor eCCurve'_parser eCCurve_a_parser _ = (LL.gaccessor_then_fst (LL.gaccessor_id eCCurve'_parser))

let gaccessor'_eCCurve_b : LL.gaccessor eCCurve'_parser eCCurve_b_parser _ = (LL.gaccessor_then_snd (LL.gaccessor_id eCCurve'_parser))

inline_for_extraction noextract let accessor'_eCCurve_a : LL.accessor gaccessor'_eCCurve_a = (LL.accessor_then_fst (LL.accessor_id eCCurve'_parser))

inline_for_extraction noextract let accessor'_eCCurve_b : LL.accessor gaccessor'_eCCurve_b = (LL.accessor_then_snd (LL.accessor_id eCCurve'_parser) eCCurve_a_jumper)

noextract let clens_eCCurve_eCCurve' : LL.clens eCCurve eCCurve' = synth_eCCurve_recip_inverse (); synth_eCCurve_recip_injective (); LL.clens_synth synth_eCCurve_recip synth_eCCurve

let gaccessor_eCCurve_eCCurve' : LL.gaccessor eCCurve_parser eCCurve'_parser clens_eCCurve_eCCurve' = synth_eCCurve_inverse (); synth_eCCurve_injective (); synth_eCCurve_recip_inverse (); LL.gaccessor_synth eCCurve'_parser synth_eCCurve synth_eCCurve_recip ()

inline_for_extraction noextract let accessor_eCCurve_eCCurve' : LL.accessor gaccessor_eCCurve_eCCurve' = synth_eCCurve_inverse (); synth_eCCurve_injective (); synth_eCCurve_recip_inverse (); LL.accessor_synth eCCurve'_parser synth_eCCurve synth_eCCurve_recip ()

let gaccessor_eCCurve_a = LL.gaccessor_ext (gaccessor_eCCurve_eCCurve' `LL.gaccessor_compose` gaccessor'_eCCurve_a) clens_eCCurve_a ()

let accessor_eCCurve_a = LL.accessor_ext (LL.accessor_compose accessor_eCCurve_eCCurve' accessor'_eCCurve_a ()) clens_eCCurve_a ()

let gaccessor_eCCurve_b = LL.gaccessor_ext (gaccessor_eCCurve_eCCurve' `LL.gaccessor_compose` gaccessor'_eCCurve_b) clens_eCCurve_b ()

let accessor_eCCurve_b = LL.accessor_ext (LL.accessor_compose accessor_eCCurve_eCCurve' accessor'_eCCurve_b ()) clens_eCCurve_b ()
/
prims.fst.checked MiTLS.Parsers.ECCurve_b.fsti.checked MiTLS.Parsers.ECCurve_a.fsti.checked LowStar.Buffer.fst.checked LowParse.TacLib.fst.checked LowParse.Spec.AllIntegers.fst.checked LowParse.Spec.fst.checked LowParse.SLow.fst.checked LowParse.Low.fst.checked FStar.UInt8.fsti.checked FStar.UInt64.fsti.checked FStar.UInt32.fsti.checked FStar.UInt16.fsti.checked FStar.Seq.fst.checked FStar.Pervasives.Native.fst.checked FStar.Pervasives.fsti.checked FStar.List.Tot.fst.checked FStar.HyperStack.ST.fsti.checked FStar.HyperStack.fst.checked FStar.Bytes.fsti.checked
MiTLS.Parsers.ECCurve.fst
h: FStar.Monotonic.HyperStack.mem -> input: LowParse.Slice.slice rrel rel -> pos0: FStar.UInt32.t
  -> FStar.Pervasives.Lemma
      (requires
        LowParse.Low.Base.Spec.valid MiTLS.Parsers.ECCurve_a.eCCurve_a_parser h input pos0 /\
        (let pos1 =
            LowParse.Low.Base.Spec.get_valid_pos MiTLS.Parsers.ECCurve_a.eCCurve_a_parser
              h
              input
              pos0
          in
          LowParse.Low.Base.Spec.valid MiTLS.Parsers.ECCurve_b.eCCurve_b_parser h input pos1 /\
          (let pos2 =
              LowParse.Low.Base.Spec.get_valid_pos MiTLS.Parsers.ECCurve_b.eCCurve_b_parser
                h
                input
                pos1
            in
            Prims.l_True)))
      (ensures
        (let a =
            LowParse.Low.Base.Spec.contents MiTLS.Parsers.ECCurve_a.eCCurve_a_parser h input pos0
          in
          let pos1 =
            LowParse.Low.Base.Spec.get_valid_pos MiTLS.Parsers.ECCurve_a.eCCurve_a_parser
              h
              input
              pos0
          in
          let b =
            LowParse.Low.Base.Spec.contents MiTLS.Parsers.ECCurve_b.eCCurve_b_parser h input pos1
          in
          let pos2 =
            LowParse.Low.Base.Spec.get_valid_pos MiTLS.Parsers.ECCurve_b.eCCurve_b_parser
              h
              input
              pos1
          in
          LowParse.Low.Base.Spec.valid_content_pos MiTLS.Parsers.ECCurve.eCCurve_parser
            h
            input
            pos0
            (MiTLS.Parsers.ECCurve.MkeCCurve a b)
            pos2))
FStar.Monotonic.HyperStack.mem LowParse.Slice.srel LowParse.Bytes.byte LowParse.Slice.slice FStar.UInt32.t LowParse.Low.Combinators.valid_synth_intro LowParse.Spec.Combinators.and_then_kind MiTLS.Parsers.ECCurve_a.eCCurve_a_parser_kind MiTLS.Parsers.ECCurve_b.eCCurve_b_parser_kind MiTLS.Parsers.ECCurve.eCCurve' MiTLS.Parsers.ECCurve.eCCurve MiTLS.Parsers.ECCurve.eCCurve'_parser MiTLS.Parsers.ECCurve.synth_eCCurve Prims.unit MiTLS.Parsers.ECCurve.synth_eCCurve_injective FStar.Pervasives.assert_norm Prims.eq2 LowParse.Spec.Base.parser_kind MiTLS.Parsers.ECCurve.eCCurve_parser_kind MiTLS.Parsers.ECCurve.eCCurve'_parser_kind LowParse.Spec.Base.get_parser_type LowParse.Low.Combinators.valid_nondep_then_intro MiTLS.Parsers.ECCurve_a.eCCurve_a MiTLS.Parsers.ECCurve_a.eCCurve_a_parser MiTLS.Parsers.ECCurve_b.eCCurve_b MiTLS.Parsers.ECCurve_b.eCCurve_b_parser LowParse.Low.Base.Spec.get_valid_pos LowParse.Low.Base.Spec.contents
let eCCurve_valid h #_ #_ input pos0 =
  
let a = LL.contents eCCurve_a_parser h input pos0 in
let pos1 = LL.get_valid_pos eCCurve_a_parser h input pos0 in
let b = LL.contents eCCurve_b_parser h input pos1 in
let pos2 = LL.get_valid_pos eCCurve_b_parser h input pos1 in
LL.valid_nondep_then_intro h eCCurve_a_parser eCCurve_b_parser input pos0;
assert_norm (eCCurve' == LP.get_parser_type eCCurve'_parser);
assert_norm (eCCurve_parser_kind == eCCurve'_parser_kind);
synth_eCCurve_injective ();
LL.valid_synth_intro h eCCurve'_parser synth_eCCurve input pos0