val eCBasisType_bytesize_eqn (x: eCBasisType) : Lemma (eCBasisType_bytesize x == 1) [SMTPat (eCBasisType_bytesize x)]
val eCBasisType_bytesize_eqn (x: eCBasisType) : Lemma (eCBasisType_bytesize x == 1) [SMTPat (eCBasisType_bytesize x)]
let eCBasisType_bytesize_eqn x = eCBasisType_bytesize_eq x; assert (FStar.Seq.length (LP.serialize eCBasisType_serializer x) <= 1); assert (1 <= FStar.Seq.length (LP.serialize eCBasisType_serializer x))
module MiTLS.Parsers.ECBasisType

(* 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"

[@LT.Norm] inline_for_extraction let eCBasisType_enum : LP.enum eCBasisType U8.t =
  [@inline_let] let e = [
    Ec_basis_trinomial, 0z;
    Ec_basis_pentanomial, 1z;
  ] in
  [@inline_let] let _ =
    assert_norm (L.noRepeats (LP.list_map fst e))
  in
  [@inline_let] let _ = 
    assert_norm (L.noRepeats (LP.list_map snd e))
  in e

noextract let eCBasisType_repr_parser = LPI.parse_u8

noextract let eCBasisType_repr_serializer = LPI.serialize_u8

inline_for_extraction noextract let eCBasisType_repr_parser32 = LS.parse32_u8

inline_for_extraction noextract let eCBasisType_repr_serializer32 = LS.serialize32_u8

inline_for_extraction noextract let eCBasisType_repr_size32 = LSZ.size32_u8

inline_for_extraction noextract let eCBasisType_repr_validator = (LL.validate_u8 ())

inline_for_extraction noextract let eCBasisType_repr_jumper = LL.jump_u8

inline_for_extraction noextract let eCBasisType_repr_reader = LL.read_u8

inline_for_extraction noextract let eCBasisType_repr_writer = LL.write_u8

inline_for_extraction let synth_eCBasisType (x: LP.enum_key eCBasisType_enum) : Tot eCBasisType = x

inline_for_extraction let synth_eCBasisType_inv (x: eCBasisType) : Tot (LP.enum_key eCBasisType_enum) =
  [@inline_let] let _ : squash (LP.list_mem x (LP.list_map fst eCBasisType_enum)) =
    _ by (LP.synth_maybe_enum_key_inv_unknown_tac x)
  in
  x

let lemma_synth_eCBasisType_inj () : Lemma
  (LP.synth_injective synth_eCBasisType) = ()

let lemma_synth_eCBasisType_inv () : Lemma
  (LP.synth_inverse synth_eCBasisType synth_eCBasisType_inv) = ()

noextract let parse_eCBasisType_key : LP.parser _ (LP.enum_key eCBasisType_enum) =
  LP.parse_enum_key eCBasisType_repr_parser eCBasisType_enum

noextract let serialize_eCBasisType_key : LP.serializer parse_eCBasisType_key =
  LP.serialize_enum_key eCBasisType_repr_parser eCBasisType_repr_serializer eCBasisType_enum

noextract let eCBasisType_parser : LP.parser _ eCBasisType =
  lemma_synth_eCBasisType_inj ();
  parse_eCBasisType_key `LP.parse_synth` synth_eCBasisType

noextract let eCBasisType_serializer : LP.serializer eCBasisType_parser =
  lemma_synth_eCBasisType_inj ();
  lemma_synth_eCBasisType_inv ();
  LP.serialize_synth _ synth_eCBasisType serialize_eCBasisType_key synth_eCBasisType_inv ()

let eCBasisType_bytesize (x:eCBasisType) : GTot nat = Seq.length (eCBasisType_serializer x)

let eCBasisType_bytesize_eq x = ()

let parse32_eCBasisType_key : LS.parser32 parse_eCBasisType_key =
  FStar.Tactics.synth_by_tactic (LS.parse32_enum_key_tac eCBasisType_repr_parser32 eCBasisType_enum)

let eCBasisType_parser32 : LS.parser32 eCBasisType_parser =
  lemma_synth_eCBasisType_inj ();
  LS.parse32_synth _ synth_eCBasisType (fun x->synth_eCBasisType x) parse32_eCBasisType_key ()

let serialize32_eCBasisType_key : LS.serializer32 serialize_eCBasisType_key =
  FStar.Tactics.synth_by_tactic (LS.serialize32_enum_key_gen_tac
    eCBasisType_repr_serializer32 eCBasisType_enum)

let eCBasisType_serializer32 : LS.serializer32 eCBasisType_serializer =
  lemma_synth_eCBasisType_inj ();
  lemma_synth_eCBasisType_inv ();
  LS.serialize32_synth _ synth_eCBasisType _ serialize32_eCBasisType_key synth_eCBasisType_inv (fun x->synth_eCBasisType_inv x) ()

let eCBasisType_size32 =
  [@inline_let] let _ = assert_norm (LSZ.size32_constant_precond eCBasisType_serializer 1ul) in
  LSZ.size32_constant eCBasisType_serializer 1ul ()

[@@ (LT.postprocess_with LT.pp_norm_tac)]
inline_for_extraction let validate_eCBasisType_key : LL.validator parse_eCBasisType_key =
    LL.mk_validate_enum_key eCBasisType_repr_validator eCBasisType_repr_reader eCBasisType_enum

let eCBasisType_validator =
  lemma_synth_eCBasisType_inj ();
  LL.validate_synth validate_eCBasisType_key synth_eCBasisType ()

[@@ (LT.postprocess_with LT.pp_norm_tac) ]
inline_for_extraction let read_eCBasisType_key : LL.leaf_reader parse_eCBasisType_key =
  LL.mk_read_enum_key eCBasisType_repr_reader eCBasisType_enum

let eCBasisType_reader =
 [@inline_let] let _ = lemma_synth_eCBasisType_inj () in
 LL.read_synth' parse_eCBasisType_key synth_eCBasisType read_eCBasisType_key ()

inline_for_extraction let write_eCBasisType_key : LL.leaf_writer_strong serialize_eCBasisType_key =
  LL.write_enum_key eCBasisType_repr_writer eCBasisType_enum (_ by (LP.enum_repr_of_key_tac eCBasisType_enum))

inline_for_extraction let lserialize_eCBasisType_key : LL.serializer32 serialize_eCBasisType_key =
  LL.serializer32_of_leaf_writer_strong_constant_size write_eCBasisType_key 1ul ()

let eCBasisType_writer =
  [@inline_let] let _ = lemma_synth_eCBasisType_inj (); lemma_synth_eCBasisType_inv () in
  LL.write_synth write_eCBasisType_key synth_eCBasisType synth_eCBasisType_inv (fun x -> synth_eCBasisType_inv x) ()

let eCBasisType_lserializer = LL.serializer32_of_leaf_writer_strong_constant_size eCBasisType_writer 1ul ()
/
prims.fst.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.Tactics.Effect.fsti.checked FStar.Tactics.fst.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.ECBasisType.fst
x: MiTLS.Parsers.ECBasisType.eCBasisType
  -> FStar.Pervasives.Lemma (ensures MiTLS.Parsers.ECBasisType.eCBasisType_bytesize x == 1)
      [SMTPat (MiTLS.Parsers.ECBasisType.eCBasisType_bytesize x)]
MiTLS.Parsers.ECBasisType.eCBasisType Prims._assert Prims.b2t Prims.op_LessThanOrEqual FStar.Seq.Base.length LowParse.Bytes.byte LowParse.Spec.Base.serialize MiTLS.Parsers.ECBasisType.eCBasisType_parser_kind MiTLS.Parsers.ECBasisType.eCBasisType_parser MiTLS.Parsers.ECBasisType.eCBasisType_serializer Prims.unit MiTLS.Parsers.ECBasisType.eCBasisType_bytesize_eq
let eCBasisType_bytesize_eqn x =
  
eCBasisType_bytesize_eq x;
assert (FStar.Seq.length (LP.serialize eCBasisType_serializer x) <= 1);
assert (1 <= FStar.Seq.length (LP.serialize eCBasisType_serializer x))