val handshakeType_lserializer: LL.serializer32 handshakeType_serializer
val handshakeType_lserializer: LL.serializer32 handshakeType_serializer
let handshakeType_lserializer = LL.serializer32_of_leaf_writer_strong_constant_size handshakeType_writer 1ul ()
module MiTLS.Parsers.HandshakeType

(* 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 handshakeType_enum : LP.enum handshakeType U8.t =
  [@inline_let] let e = [
    Hello_request, 0z;
    Client_hello, 1z;
    Server_hello, 2z;
    New_session_ticket, 4z;
    End_of_early_data, 5z;
    Encrypted_extensions, 8z;
    Certificate, 11z;
    Server_key_exchange, 12z;
    Certificate_request, 13z;
    Server_hello_done, 14z;
    Certificate_verify, 15z;
    Client_key_exchange, 16z;
    Finished, 20z;
    Key_update, 24z;
    Message_hash, 254z;
  ] 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 handshakeType_repr_parser = LPI.parse_u8

noextract let handshakeType_repr_serializer = LPI.serialize_u8

inline_for_extraction noextract let handshakeType_repr_parser32 = LS.parse32_u8

inline_for_extraction noextract let handshakeType_repr_serializer32 = LS.serialize32_u8

inline_for_extraction noextract let handshakeType_repr_size32 = LSZ.size32_u8

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

inline_for_extraction noextract let handshakeType_repr_jumper = LL.jump_u8

inline_for_extraction noextract let handshakeType_repr_reader = LL.read_u8

inline_for_extraction noextract let handshakeType_repr_writer = LL.write_u8

inline_for_extraction let synth_handshakeType (x: LP.enum_key handshakeType_enum) : Tot handshakeType = x

inline_for_extraction let synth_handshakeType_inv (x: handshakeType) : Tot (LP.enum_key handshakeType_enum) =
  [@inline_let] let _ : squash (LP.list_mem x (LP.list_map fst handshakeType_enum)) =
    _ by (LP.synth_maybe_enum_key_inv_unknown_tac x)
  in
  x

let lemma_synth_handshakeType_inj () : Lemma
  (LP.synth_injective synth_handshakeType) = ()

let lemma_synth_handshakeType_inv () : Lemma
  (LP.synth_inverse synth_handshakeType synth_handshakeType_inv) = ()

noextract let parse_handshakeType_key : LP.parser _ (LP.enum_key handshakeType_enum) =
  LP.parse_enum_key handshakeType_repr_parser handshakeType_enum

noextract let serialize_handshakeType_key : LP.serializer parse_handshakeType_key =
  LP.serialize_enum_key handshakeType_repr_parser handshakeType_repr_serializer handshakeType_enum

noextract let handshakeType_parser : LP.parser _ handshakeType =
  lemma_synth_handshakeType_inj ();
  parse_handshakeType_key `LP.parse_synth` synth_handshakeType

noextract let handshakeType_serializer : LP.serializer handshakeType_parser =
  lemma_synth_handshakeType_inj ();
  lemma_synth_handshakeType_inv ();
  LP.serialize_synth _ synth_handshakeType serialize_handshakeType_key synth_handshakeType_inv ()

let handshakeType_bytesize (x:handshakeType) : GTot nat = Seq.length (handshakeType_serializer x)

let handshakeType_bytesize_eq x = ()

let parse32_handshakeType_key : LS.parser32 parse_handshakeType_key =
  FStar.Tactics.synth_by_tactic (LS.parse32_enum_key_tac handshakeType_repr_parser32 handshakeType_enum)

let handshakeType_parser32 : LS.parser32 handshakeType_parser =
  lemma_synth_handshakeType_inj ();
  LS.parse32_synth _ synth_handshakeType (fun x->synth_handshakeType x) parse32_handshakeType_key ()

let serialize32_handshakeType_key : LS.serializer32 serialize_handshakeType_key =
  FStar.Tactics.synth_by_tactic (LS.serialize32_enum_key_gen_tac
    handshakeType_repr_serializer32 handshakeType_enum)

let handshakeType_serializer32 : LS.serializer32 handshakeType_serializer =
  lemma_synth_handshakeType_inj ();
  lemma_synth_handshakeType_inv ();
  LS.serialize32_synth _ synth_handshakeType _ serialize32_handshakeType_key synth_handshakeType_inv (fun x->synth_handshakeType_inv x) ()

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

[@@ (LT.postprocess_with LT.pp_norm_tac)]
inline_for_extraction let validate_handshakeType_key : LL.validator parse_handshakeType_key =
    LL.mk_validate_enum_key handshakeType_repr_validator handshakeType_repr_reader handshakeType_enum

let handshakeType_validator =
  lemma_synth_handshakeType_inj ();
  LL.validate_synth validate_handshakeType_key synth_handshakeType ()

[@@ (LT.postprocess_with LT.pp_norm_tac) ]
inline_for_extraction let read_handshakeType_key : LL.leaf_reader parse_handshakeType_key =
  LL.mk_read_enum_key handshakeType_repr_reader handshakeType_enum

let handshakeType_reader =
 [@inline_let] let _ = lemma_synth_handshakeType_inj () in
 LL.read_synth' parse_handshakeType_key synth_handshakeType read_handshakeType_key ()

inline_for_extraction let write_handshakeType_key : LL.leaf_writer_strong serialize_handshakeType_key =
  LL.write_enum_key handshakeType_repr_writer handshakeType_enum (_ by (LP.enum_repr_of_key_tac handshakeType_enum))

inline_for_extraction let lserialize_handshakeType_key : LL.serializer32 serialize_handshakeType_key =
  LL.serializer32_of_leaf_writer_strong_constant_size write_handshakeType_key 1ul ()

let handshakeType_writer =
  [@inline_let] let _ = lemma_synth_handshakeType_inj (); lemma_synth_handshakeType_inv () in
  LL.write_synth write_handshakeType_key synth_handshakeType synth_handshakeType_inv (fun x -> synth_handshakeType_inv x) ()
/
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.HandshakeType.fst
LowParse.Low.Base.serializer32 MiTLS.Parsers.HandshakeType.handshakeType_serializer
LowParse.Low.Base.serializer32_of_leaf_writer_strong_constant_size MiTLS.Parsers.HandshakeType.handshakeType_parser_kind MiTLS.Parsers.HandshakeType.handshakeType MiTLS.Parsers.HandshakeType.handshakeType_parser MiTLS.Parsers.HandshakeType.handshakeType_serializer MiTLS.Parsers.HandshakeType.handshakeType_writer FStar.UInt32.__uint_to_t
let handshakeType_lserializer =
  
LL.serializer32_of_leaf_writer_strong_constant_size handshakeType_writer 1ul ()