val serialize_maybe_protocolVersion_key:LP.serializer parse_maybe_protocolVersion_key
let serialize_maybe_protocolVersion_key : LP.serializer parse_maybe_protocolVersion_key =
  LP.serialize_maybe_enum_key protocolVersion_repr_parser protocolVersion_repr_serializer protocolVersion_enum
val serialize_maybe_protocolVersion_key:LP.serializer parse_maybe_protocolVersion_key
let serialize_maybe_protocolVersion_key:LP.serializer parse_maybe_protocolVersion_key =
LP.serialize_maybe_enum_key protocolVersion_repr_parser
  protocolVersion_repr_serializer
  protocolVersion_enum
Parsers.ProtocolVersion.fst.checked
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
Parsers.ProtocolVersion.fst
LowParse.Spec.Enum.serialize_maybe_enum_key LowParse.Spec.Int.parse_u16_kind Parsers.ProtocolVersion.protocolVersion FStar.UInt16.t Parsers.ProtocolVersion.protocolVersion_repr_parser Parsers.ProtocolVersion.protocolVersion_repr_serializer Parsers.ProtocolVersion.protocolVersion_enum
module Parsers.ProtocolVersion

(* 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 protocolVersion_enum : LP.enum protocolVersion U16.t =
  [@inline_let] let e = [
    SSL_3p0, 768us;
    TLS_1p0, 769us;
    TLS_1p1, 770us;
    TLS_1p2, 771us;
    TLS_1p3, 772us;
  ] 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 protocolVersion_repr_parser = LPI.parse_u16

noextract let protocolVersion_repr_serializer = LPI.serialize_u16

inline_for_extraction noextract let protocolVersion_repr_parser32 = LS.parse32_u16

inline_for_extraction noextract let protocolVersion_repr_serializer32 = LS.serialize32_u16

inline_for_extraction noextract let protocolVersion_repr_size32 = LSZ.size32_u16

inline_for_extraction noextract let protocolVersion_repr_validator = (LL.validate_u16 ())

inline_for_extraction noextract let protocolVersion_repr_jumper = LL.jump_u16

inline_for_extraction noextract let protocolVersion_repr_reader = LL.read_u16

inline_for_extraction noextract let protocolVersion_repr_writer = LL.write_u16

inline_for_extraction let synth_protocolVersion (x:LP.maybe_enum_key protocolVersion_enum) : protocolVersion = 
  match x with
  | LP.Known k -> k
  | LP.Unknown y ->
    [@inline_let] let v : U16.t = y in
    [@inline_let] let _ = assert_norm (LP.list_mem v (LP.list_map snd protocolVersion_enum) == known_protocolVersion_repr v) in
    Unknown_protocolVersion v

inline_for_extraction let synth_protocolVersion_inv (x:protocolVersion) : LP.maybe_enum_key protocolVersion_enum = 
  match x with
  | Unknown_protocolVersion y ->
    [@inline_let] let v : U16.t = y in
    [@inline_let] let _ = assert_norm (LP.list_mem v (LP.list_map snd protocolVersion_enum) == known_protocolVersion_repr v) in
    LP.Unknown v
  | x ->
    [@inline_let] let x1 : protocolVersion = x in
    [@inline_let] let _ : squash(not (Unknown_protocolVersion? x1) ==> LP.list_mem x1 (LP.list_map fst protocolVersion_enum)) =
      _ by (LP.synth_maybe_enum_key_inv_unknown_tac x1)
    in
    LP.Known (x1 <: LP.enum_key protocolVersion_enum)

let lemma_synth_protocolVersion_inv' () : Lemma
  (LP.synth_inverse synth_protocolVersion_inv synth_protocolVersion)
= LP.forall_maybe_enum_key protocolVersion_enum (fun x -> synth_protocolVersion_inv (synth_protocolVersion x) == x)
    (_ by (LP.forall_maybe_enum_key_known_tac ()))
    (_ by (LP.forall_maybe_enum_key_unknown_tac ()))

let lemma_synth_protocolVersion_inj () : Lemma
  (LP.synth_injective synth_protocolVersion) = 
  lemma_synth_protocolVersion_inv' ();
  LP.synth_inverse_synth_injective synth_protocolVersion synth_protocolVersion_inv

#push-options "--max_ifuel 0 --initial_ifuel 0 --max_fuel 0 --max_ifuel 0"
let lemma_synth_protocolVersion_inv () : Lemma
  (LP.synth_inverse synth_protocolVersion synth_protocolVersion_inv) = allow_inversion protocolVersion; ()

#pop-options
noextract let parse_maybe_protocolVersion_key : LP.parser _ (LP.maybe_enum_key protocolVersion_enum) =
  LP.parse_maybe_enum_key protocolVersion_repr_parser protocolVersion_enum
val serialize_maybe_protocolVersion_key:LP.serializer parse_maybe_protocolVersion_key
LowParse.Spec.Base.serializer Parsers.ProtocolVersion.parse_maybe_protocolVersion_key