val serverName_type_of_known_case
      (k: LP.enum_key nameType_enum)
      (x: nameType)
      (q: squash ((k <: nameType) == x))
      (#x': LP.maybe_enum_key nameType_enum)
      (y: serverName_value_type x')
    : Pure
      (norm [delta_only [(`%serverName_case_of_nameType)]; iota] (serverName_case_of_nameType x))
      (requires (LP.Known k == x'))
      (ensures (fun y' -> y' == y))
val serverName_type_of_known_case
      (k: LP.enum_key nameType_enum)
      (x: nameType)
      (q: squash ((k <: nameType) == x))
      (#x': LP.maybe_enum_key nameType_enum)
      (y: serverName_value_type x')
    : Pure
      (norm [delta_only [(`%serverName_case_of_nameType)]; iota] (serverName_case_of_nameType x))
      (requires (LP.Known k == x'))
      (ensures (fun y' -> y' == y))
let serverName_type_of_known_case (k: LP.enum_key nameType_enum)
  (x:nameType) (q: squash ((k <: nameType) == x))
  (#x' : LP.maybe_enum_key nameType_enum) (y: serverName_value_type x')
  : Pure (norm [delta_only [(`%serverName_case_of_nameType)]; iota] (serverName_case_of_nameType x))
  (requires (LP.Known k == x')) (ensures (fun y' -> y' == y)) =
  [@inline_let] let _ = norm_spec [delta_only [(`%serverName_case_of_nameType)]; iota] (serverName_case_of_nameType k) in y
module MiTLS.Parsers.ServerName

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

friend MiTLS.Parsers.NameType

// Need high Z3 limits for large sum types
#set-options "--z3rlimit 60"

inline_for_extraction unfold let known_nameType_as_enum_key
  (x: nameType { norm [delta; zeta; iota; primops] (LP.list_mem x (LP.list_map fst nameType_enum)) == true })
  : LP.enum_key nameType_enum =
  [@inline_let] let _ = norm_spec [delta; zeta; iota; primops] (LP.list_mem x (LP.list_map fst nameType_enum)) in x

inline_for_extraction let unknown_nameType_as_enum_key (r:nameType_repr) : Pure (LP.unknown_enum_repr nameType_enum)
  (requires known_nameType_repr r == false) (ensures fun _ -> True) =
  [@inline_let] let _ = assert_norm(LP.list_mem r (LP.list_map snd nameType_enum) == known_nameType_repr r) in r

inline_for_extraction let unknown_enum_repr_nameType_as_repr (r:LP.unknown_enum_repr nameType_enum) : Pure nameType_repr
  (requires True) (ensures fun r -> known_nameType_repr r == false) =
  [@inline_let] let _ = assert_norm(LP.list_mem r (LP.list_map snd nameType_enum) == known_nameType_repr r) in r

inline_for_extraction let key_of_serverName (x:serverName) : LP.maybe_enum_key nameType_enum =
  match x with
  | Sni_host_name _ -> LP.Known (known_nameType_as_enum_key Host_name)
  | Sni_Unknown_nameType v _ -> LP.Unknown (unknown_nameType_as_enum_key v)

inline_for_extraction let serverName_case_of_nameType (x:nameType) : Type0 =
  match x with
  | Host_name -> hostName
  | Unknown_nameType _ -> squash False

unfold inline_for_extraction let serverName_value_type (x:LP.maybe_enum_key nameType_enum) =
  LP.dsum_type_of_tag' nameType_enum serverName_case_of_nameType unknownName x

unfold inline_for_extraction let serverName_refine (k:LP.maybe_enum_key nameType_enum) (x:serverName)
  : Pure (LP.refine_with_tag key_of_serverName k)
  (requires key_of_serverName x == k) (ensures fun y -> y == x) =
  [@inline_let] let _ = norm_spec [delta; iota; zeta] (key_of_serverName x) in x
/
prims.fst.checked MiTLS.Parsers.NameType.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.Seq.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.ServerName.fst

    k: LowParse.Spec.Enum.enum_key MiTLS.Parsers.NameType.nameType_enum ->
    x: MiTLS.Parsers.NameType.nameType ->
    q: Prims.squash (k == x) ->
    y: MiTLS.Parsers.ServerName.serverName_value_type x'
  -> Prims.Pure
    (FStar.Pervasives.norm [
          FStar.Pervasives.delta_only ["MiTLS.Parsers.ServerName.serverName_case_of_nameType"];
          FStar.Pervasives.iota
        ]
        (MiTLS.Parsers.ServerName.serverName_case_of_nameType x))
LowParse.Spec.Enum.enum_key MiTLS.Parsers.NameType.nameType FStar.UInt8.t MiTLS.Parsers.NameType.nameType_enum Prims.squash Prims.eq2 LowParse.Spec.Enum.maybe_enum_key MiTLS.Parsers.ServerName.serverName_value_type Prims.unit FStar.Pervasives.norm_spec Prims.Cons FStar.Pervasives.norm_step FStar.Pervasives.delta_only Prims.string Prims.Nil FStar.Pervasives.iota MiTLS.Parsers.ServerName.serverName_case_of_nameType FStar.Pervasives.norm LowParse.Spec.Enum.Known MiTLS.Parsers.HostName.hostName Prims.b2t Prims.op_Negation MiTLS.Parsers.NameType.known_nameType_repr Prims.l_False
let serverName_type_of_known_case
      (k: LP.enum_key nameType_enum)
      (x: nameType)
      (q: squash ((k <: nameType) == x))
      (#x': LP.maybe_enum_key nameType_enum)
      (y: serverName_value_type x')
    : Pure
      (norm [delta_only [(`%serverName_case_of_nameType)]; iota] (serverName_case_of_nameType x))
      (requires (LP.Known k == x'))
      (ensures (fun y' -> y' == y)) =
  
[@@ inline_let ]let _ =
  norm_spec [delta_only [(`%serverName_case_of_nameType)]; iota] (serverName_case_of_nameType k)
in
y