val cipherSuite_parser32: LS.parser32 cipherSuite_parser
val cipherSuite_parser32: LS.parser32 cipherSuite_parser
let cipherSuite_parser32 : LS.parser32 cipherSuite_parser =
  lemma_synth_cipherSuite_inj ();
  LS.parse32_synth _ synth_cipherSuite (fun x->synth_cipherSuite x) parse32_maybe_cipherSuite_key ()
module MiTLS.Parsers.CipherSuite

(* 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 cipherSuite_enum : LP.enum cipherSuite U16.t =
  [@inline_let] let e = [
    TLS_NULL_WITH_NULL_NULL, 0us;
    TLS_RSA_WITH_NULL_MD5, 1us;
    TLS_RSA_WITH_NULL_SHA, 2us;
    TLS_RSA_WITH_RC4_128_MD5, 4us;
    TLS_RSA_WITH_RC4_128_SHA, 5us;
    TLS_RSA_WITH_3DES_EDE_CBC_SHA, 10us;
    TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA, 19us;
    TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA, 22us;
    TLS_DH_anon_WITH_RC4_128_MD5, 24us;
    TLS_DH_anon_WITH_3DES_EDE_CBC_SHA, 27us;
    TLS_RSA_WITH_AES_128_CBC_SHA, 47us;
    TLS_DHE_DSS_WITH_AES_128_CBC_SHA, 50us;
    TLS_DHE_RSA_WITH_AES_128_CBC_SHA, 51us;
    TLS_DH_anon_WITH_AES_128_CBC_SHA, 52us;
    TLS_RSA_WITH_AES_256_CBC_SHA, 53us;
    TLS_DHE_DSS_WITH_AES_256_CBC_SHA, 56us;
    TLS_DHE_RSA_WITH_AES_256_CBC_SHA, 57us;
    TLS_DH_anon_WITH_AES_256_CBC_SHA, 58us;
    TLS_RSA_WITH_NULL_SHA256, 59us;
    TLS_RSA_WITH_AES_128_CBC_SHA256, 60us;
    TLS_RSA_WITH_AES_256_CBC_SHA256, 61us;
    TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, 64us;
    TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, 103us;
    TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, 106us;
    TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, 107us;
    TLS_DH_anon_WITH_AES_128_CBC_SHA256, 108us;
    TLS_DH_anon_WITH_AES_256_CBC_SHA256, 109us;
    TLS_RSA_WITH_AES_128_GCM_SHA256, 156us;
    TLS_RSA_WITH_AES_256_GCM_SHA384, 157us;
    TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, 158us;
    TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, 159us;
    TLS_DH_RSA_WITH_AES_128_GCM_SHA256, 160us;
    TLS_DH_RSA_WITH_AES_256_GCM_SHA384, 161us;
    TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, 162us;
    TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, 163us;
    TLS_DH_DSS_WITH_AES_128_GCM_SHA256, 164us;
    TLS_DH_DSS_WITH_AES_256_GCM_SHA384, 165us;
    TLS_DH_anon_WITH_AES_128_GCM_SHA256, 166us;
    TLS_DH_anon_WITH_AES_256_GCM_SHA384, 167us;
    TLS_AES_128_GCM_SHA256, 4865us;
    TLS_AES_256_GCM_SHA384, 4866us;
    TLS_CHACHA20_POLY1305_SHA256, 4867us;
    TLS_AES_128_CCM_SHA256, 4868us;
    TLS_AES_128_CCM_8_SHA256, 4869us;
    TLS_ECDHE_RSA_WITH_RC4_128_SHA, 49169us;
    TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, 49170us;
    TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, 49171us;
    TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, 49172us;
    TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, 49191us;
    TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, 49192us;
    TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, 49195us;
    TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, 49196us;
    TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, 49199us;
    TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, 49200us;
    TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, 52392us;
    TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, 52393us;
    TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256, 52394us;
    TLS_PSK_WITH_CHACHA20_POLY1305_SHA256, 52395us;
    TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256, 52396us;
    TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256, 52397us;
  ] 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 cipherSuite_repr_parser = LPI.parse_u16

noextract let cipherSuite_repr_serializer = LPI.serialize_u16

inline_for_extraction noextract let cipherSuite_repr_parser32 = LS.parse32_u16

inline_for_extraction noextract let cipherSuite_repr_serializer32 = LS.serialize32_u16

inline_for_extraction noextract let cipherSuite_repr_size32 = LSZ.size32_u16

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

inline_for_extraction noextract let cipherSuite_repr_jumper = LL.jump_u16

inline_for_extraction noextract let cipherSuite_repr_reader = LL.read_u16

inline_for_extraction noextract let cipherSuite_repr_writer = LL.write_u16

inline_for_extraction let synth_cipherSuite (x:LP.maybe_enum_key cipherSuite_enum) : cipherSuite = 
  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 cipherSuite_enum) == known_cipherSuite_repr v) in
    Unknown_cipherSuite v

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

let lemma_synth_cipherSuite_inv' () : Lemma
  (LP.synth_inverse synth_cipherSuite_inv synth_cipherSuite)
= LP.forall_maybe_enum_key cipherSuite_enum (fun x -> synth_cipherSuite_inv (synth_cipherSuite x) == x)
    (_ by (LP.forall_maybe_enum_key_known_tac ()))
    (_ by (LP.forall_maybe_enum_key_unknown_tac ()))

let lemma_synth_cipherSuite_inj () : Lemma
  (LP.synth_injective synth_cipherSuite) = 
  lemma_synth_cipherSuite_inv' ();
  LP.synth_inverse_synth_injective synth_cipherSuite synth_cipherSuite_inv

#push-options "--max_ifuel 0 --initial_ifuel 0 --max_fuel 0 --max_ifuel 0"
let lemma_synth_cipherSuite_inv () : Lemma
  (LP.synth_inverse synth_cipherSuite synth_cipherSuite_inv) = allow_inversion cipherSuite; ()

#pop-options
noextract let parse_maybe_cipherSuite_key : LP.parser _ (LP.maybe_enum_key cipherSuite_enum) =
  LP.parse_maybe_enum_key cipherSuite_repr_parser cipherSuite_enum

noextract let serialize_maybe_cipherSuite_key : LP.serializer parse_maybe_cipherSuite_key =
  LP.serialize_maybe_enum_key cipherSuite_repr_parser cipherSuite_repr_serializer cipherSuite_enum

noextract let cipherSuite_parser : LP.parser _ cipherSuite =
  lemma_synth_cipherSuite_inj ();
  parse_maybe_cipherSuite_key `LP.parse_synth` synth_cipherSuite

noextract let cipherSuite_serializer : LP.serializer cipherSuite_parser =
  lemma_synth_cipherSuite_inj ();
  lemma_synth_cipherSuite_inv ();
  LP.serialize_synth _ synth_cipherSuite serialize_maybe_cipherSuite_key synth_cipherSuite_inv ()

let cipherSuite_bytesize (x:cipherSuite) : GTot nat = Seq.length (cipherSuite_serializer x)

let cipherSuite_bytesize_eq x = ()

let parse32_maybe_cipherSuite_key : LS.parser32 parse_maybe_cipherSuite_key =
  FStar.Tactics.synth_by_tactic (LS.parse32_maybe_enum_key_tac cipherSuite_repr_parser32 cipherSuite_enum)
/
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.CipherSuite.fst
LowParse.SLow.Base.parser32 MiTLS.Parsers.CipherSuite.cipherSuite_parser
LowParse.SLow.Combinators.parse32_synth LowParse.Spec.Int.parse_u16_kind LowParse.Spec.Enum.maybe_enum_key MiTLS.Parsers.CipherSuite.cipherSuite FStar.UInt16.t MiTLS.Parsers.CipherSuite.cipherSuite_enum MiTLS.Parsers.CipherSuite.parse_maybe_cipherSuite_key MiTLS.Parsers.CipherSuite.synth_cipherSuite Prims.eq2 MiTLS.Parsers.CipherSuite.parse32_maybe_cipherSuite_key Prims.unit MiTLS.Parsers.CipherSuite.lemma_synth_cipherSuite_inj LowParse.SLow.Base.parser32 MiTLS.Parsers.CipherSuite.cipherSuite_parser_kind MiTLS.Parsers.CipherSuite.cipherSuite_parser
let cipherSuite_parser32:LS.parser32 cipherSuite_parser =
  
lemma_synth_cipherSuite_inj ();
LS.parse32_synth _ synth_cipherSuite (fun x -> synth_cipherSuite x) parse32_maybe_cipherSuite_key ()