val serialize32_char2Representation_cases (x: LP.sum_key char2Representation_sum)
    : LS.serializer32 (serialize_char2Representation_cases x)
val serialize32_char2Representation_cases (x: LP.sum_key char2Representation_sum)
    : LS.serializer32 (serialize_char2Representation_cases x)
let serialize32_char2Representation_cases (x:LP.sum_key char2Representation_sum)
  : LS.serializer32 (serialize_char2Representation_cases x) =
  match x with
  | Ec_basis_trinomial -> [@inline_let] let u : LS.serializer32 (serialize_char2Representation_cases Ec_basis_trinomial) = char2Trinomial_serializer32 in u
  | Ec_basis_pentanomial -> [@inline_let] let u : LS.serializer32 (serialize_char2Representation_cases Ec_basis_pentanomial) = char2Pentanomial_serializer32 in u
  | _ -> LS.serialize32_false
module MiTLS.Parsers.Char2Representation

(* 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.ECBasisType

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

inline_for_extraction unfold let eCBasisType_as_enum_key (x:eCBasisType) : Pure (LP.enum_key eCBasisType_enum)
  (requires norm [delta; zeta; iota; primops] (LP.list_mem x (LP.list_map fst eCBasisType_enum)) == true) (ensures fun _ -> True) =
  [@inline_let] let _ = norm_spec [delta; zeta; iota; primops] (LP.list_mem x (LP.list_map fst eCBasisType_enum)) in x

inline_for_extraction let key_of_char2Representation (x:char2Representation) : LP.enum_key eCBasisType_enum =
  match x with
  | Repr_ec_basis_trinomial _ -> eCBasisType_as_enum_key Ec_basis_trinomial
  | Repr_ec_basis_pentanomial _ -> eCBasisType_as_enum_key Ec_basis_pentanomial

inline_for_extraction let char2Representation_case_of_eCBasisType (x:eCBasisType) : Type0 =
  match x with
  | Ec_basis_trinomial -> char2Trinomial
  | Ec_basis_pentanomial -> char2Pentanomial

unfold inline_for_extraction let to_char2Representation_case_of_eCBasisType (x:eCBasisType) (#x':eCBasisType) (y:char2Representation_case_of_eCBasisType x')  : Pure (norm [delta_only [(`%char2Representation_case_of_eCBasisType)]; iota] (char2Representation_case_of_eCBasisType x))
  (requires (x == x')) (ensures (fun y' -> y' == y)) =
  [@inline_let] let _ = norm_spec [delta_only [(`%char2Representation_case_of_eCBasisType)] ; iota] (char2Representation_case_of_eCBasisType x) in y

unfold inline_for_extraction let char2Representation_refine (k:LP.enum_key eCBasisType_enum) (x:char2Representation)
  : Pure (LP.refine_with_tag key_of_char2Representation k)  (requires norm [delta; iota; zeta] (key_of_char2Representation x) == k) (ensures (fun y -> y == x)) =
  [@inline_let] let _ = norm_spec [delta; iota; zeta] (key_of_char2Representation x) in x

inline_for_extraction let synth_char2Representation_cases (x:LP.enum_key eCBasisType_enum) (y:char2Representation_case_of_eCBasisType x)
  : LP.refine_with_tag key_of_char2Representation x =
  match x with
  | Ec_basis_trinomial -> char2Representation_refine x (Repr_ec_basis_trinomial (to_char2Representation_case_of_eCBasisType Ec_basis_trinomial y))
  | Ec_basis_pentanomial -> char2Representation_refine x (Repr_ec_basis_pentanomial (to_char2Representation_case_of_eCBasisType Ec_basis_pentanomial y))

unfold inline_for_extraction let from_char2Representation_case_of_eCBasisType (#x':eCBasisType) (x:eCBasisType)
  (y: norm [delta_only [(`%char2Representation_case_of_eCBasisType)]; iota] (char2Representation_case_of_eCBasisType x))
  : Pure (char2Representation_case_of_eCBasisType x') (requires (x == x')) (ensures (fun y' -> y' == y)) =
  [@inline_let] let _ = norm_spec [delta_only [(`%char2Representation_case_of_eCBasisType)] ; iota] (char2Representation_case_of_eCBasisType x) in y

let synth_char2Representation_cases_recip_pre (k:LP.enum_key eCBasisType_enum)
  (x:LP.refine_with_tag key_of_char2Representation k) : GTot bool =
  match k with
  | Ec_basis_trinomial -> Repr_ec_basis_trinomial? x
  | Ec_basis_pentanomial -> Repr_ec_basis_pentanomial? x

let synth_char2Representation_cases_recip_pre_intro (k:LP.enum_key eCBasisType_enum) (x:LP.refine_with_tag key_of_char2Representation k)
  : Lemma (synth_char2Representation_cases_recip_pre k x == true) =
  norm_spec [delta; iota] (synth_char2Representation_cases_recip_pre k x)

inline_for_extraction let synth_char2Representation_cases_recip (k:LP.enum_key eCBasisType_enum)
  (x:LP.refine_with_tag key_of_char2Representation k) : (char2Representation_case_of_eCBasisType k) =
  match k with
  | Ec_basis_trinomial -> [@inline_let] let _ = synth_char2Representation_cases_recip_pre_intro Ec_basis_trinomial x in
    (match x with Repr_ec_basis_trinomial y -> (from_char2Representation_case_of_eCBasisType Ec_basis_trinomial y))
  | Ec_basis_pentanomial -> [@inline_let] let _ = synth_char2Representation_cases_recip_pre_intro Ec_basis_pentanomial x in
    (match x with Repr_ec_basis_pentanomial y -> (from_char2Representation_case_of_eCBasisType Ec_basis_pentanomial y))

inline_for_extraction let char2Representation_sum = LP.make_sum' eCBasisType_enum key_of_char2Representation
  char2Representation_case_of_eCBasisType synth_char2Representation_cases synth_char2Representation_cases_recip
  (_ by (LP.make_sum_synth_case_recip_synth_case_tac ()))
  (_ by (LP.synth_case_synth_case_recip_tac ()))

noextract let parse_char2Representation_cases (x:LP.sum_key char2Representation_sum)
  : k:LP.parser_kind & LP.parser k (char2Representation_case_of_eCBasisType x) =
  match x with
  | Ec_basis_trinomial -> [@inline_let] let u : (k: LP.parser_kind & LP.parser k (char2Representation_case_of_eCBasisType Ec_basis_trinomial)) = (| _, char2Trinomial_parser |) in u
  | Ec_basis_pentanomial -> [@inline_let] let u : (k: LP.parser_kind & LP.parser k (char2Representation_case_of_eCBasisType Ec_basis_pentanomial)) = (| _, char2Pentanomial_parser |) in u
  | _ -> (| _, LP.parse_false |)

noextract let serialize_char2Representation_cases (x:LP.sum_key char2Representation_sum)
  : LP.serializer (dsnd (parse_char2Representation_cases x)) =
  match x with
  | Ec_basis_trinomial -> [@inline_let] let u : LP.serializer (dsnd (parse_char2Representation_cases Ec_basis_trinomial)) = char2Trinomial_serializer in u
  | Ec_basis_pentanomial -> [@inline_let] let u : LP.serializer (dsnd (parse_char2Representation_cases Ec_basis_pentanomial)) = char2Pentanomial_serializer in u
  | _ -> LP.serialize_false

inline_for_extraction noextract let parse32_char2Representation_cases (x:LP.sum_key char2Representation_sum)
  : LS.parser32 (dsnd (parse_char2Representation_cases x)) =
  match x with
  | Ec_basis_trinomial -> [@inline_let] let u : LS.parser32 (dsnd (parse_char2Representation_cases Ec_basis_trinomial)) = char2Trinomial_parser32 in u
  | Ec_basis_pentanomial -> [@inline_let] let u : LS.parser32 (dsnd (parse_char2Representation_cases Ec_basis_pentanomial)) = char2Pentanomial_parser32 in u
  | _ -> LS.parse32_false
/
prims.fst.checked MiTLS.Parsers.ECBasisType.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.Char2Representation.fst
x: LowParse.Spec.Sum.sum_key MiTLS.Parsers.Char2Representation.char2Representation_sum
  -> LowParse.SLow.Base.serializer32 (MiTLS.Parsers.Char2Representation.serialize_char2Representation_cases
          x)
LowParse.Spec.Sum.sum_key MiTLS.Parsers.Char2Representation.char2Representation_sum LowParse.SLow.Base.serializer32 Prims.__proj__Mkdtuple2__item___1 LowParse.Spec.Base.parser_kind LowParse.Spec.Base.parser MiTLS.Parsers.Char2Representation.char2Representation_case_of_eCBasisType MiTLS.Parsers.ECBasisType.Ec_basis_trinomial MiTLS.Parsers.Char2Representation.parse_char2Representation_cases FStar.Pervasives.dsnd MiTLS.Parsers.Char2Representation.serialize_char2Representation_cases MiTLS.Parsers.Char2Trinomial.char2Trinomial_serializer32 MiTLS.Parsers.ECBasisType.Ec_basis_pentanomial MiTLS.Parsers.Char2Pentanomial.char2Pentanomial_serializer32 MiTLS.Parsers.ECBasisType.eCBasisType LowParse.SLow.Combinators.serialize32_false
let serialize32_char2Representation_cases (x: LP.sum_key char2Representation_sum)
    : LS.serializer32 (serialize_char2Representation_cases x) =
  
match x with
| Ec_basis_trinomial ->
  [@@ inline_let ]let u:LS.serializer32 (serialize_char2Representation_cases Ec_basis_trinomial) =
    char2Trinomial_serializer32
  in
  u
| Ec_basis_pentanomial ->
  [@@ inline_let ]let u:LS.serializer32 (serialize_char2Representation_cases Ec_basis_pentanomial) =
    char2Pentanomial_serializer32
  in
  u
| _ -> LS.serialize32_false