val write_maybe_compressionMethod_key:LL.leaf_writer_strong serialize_maybe_compressionMethod_key
let write_maybe_compressionMethod_key : LL.leaf_writer_strong serialize_maybe_compressionMethod_key =
  LL.write_maybe_enum_key compressionMethod_repr_writer compressionMethod_enum (_ by (LP.enum_repr_of_key_tac compressionMethod_enum))
val write_maybe_compressionMethod_key:LL.leaf_writer_strong serialize_maybe_compressionMethod_key
let write_maybe_compressionMethod_key:LL.leaf_writer_strong serialize_maybe_compressionMethod_key =
LL.write_maybe_enum_key compressionMethod_repr_writer
  compressionMethod_enum
  (FStar.Tactics.Effect.synth_by_tactic (fun _ -> (LP.enum_repr_of_key_tac compressionMethod_enum)))
Parsers.CompressionMethod.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.CompressionMethod.fst
LowParse.Low.Enum.write_maybe_enum_key Parsers.CompressionMethod.compressionMethod FStar.UInt8.t LowParse.Spec.Int.parse_u8_kind LowParse.Spec.Int.parse_u8 LowParse.Spec.Int.serialize_u8 Parsers.CompressionMethod.compressionMethod_repr_writer Parsers.CompressionMethod.compressionMethod_enum LowParse.Spec.Enum.enum_repr_of_key_cons_nil'
module Parsers.CompressionMethod

(* 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 compressionMethod_enum : LP.enum compressionMethod U8.t =
  [@inline_let] let e = [
    NullCompression, 0z;
  ] 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 compressionMethod_repr_parser = LPI.parse_u8

noextract let compressionMethod_repr_serializer = LPI.serialize_u8

inline_for_extraction noextract let compressionMethod_repr_parser32 = LS.parse32_u8

inline_for_extraction noextract let compressionMethod_repr_serializer32 = LS.serialize32_u8

inline_for_extraction noextract let compressionMethod_repr_size32 = LSZ.size32_u8

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

inline_for_extraction noextract let compressionMethod_repr_jumper = LL.jump_u8

inline_for_extraction noextract let compressionMethod_repr_reader = LL.read_u8

inline_for_extraction noextract let compressionMethod_repr_writer = LL.write_u8

inline_for_extraction let synth_compressionMethod (x:LP.maybe_enum_key compressionMethod_enum) : compressionMethod = 
  match x with
  | LP.Known k -> k
  | LP.Unknown y ->
    [@inline_let] let v : U8.t = y in
    [@inline_let] let _ = assert_norm (LP.list_mem v (LP.list_map snd compressionMethod_enum) == known_compressionMethod_repr v) in
    Unknown_compressionMethod v

inline_for_extraction let synth_compressionMethod_inv (x:compressionMethod) : LP.maybe_enum_key compressionMethod_enum = 
  match x with
  | Unknown_compressionMethod y ->
    [@inline_let] let v : U8.t = y in
    [@inline_let] let _ = assert_norm (LP.list_mem v (LP.list_map snd compressionMethod_enum) == known_compressionMethod_repr v) in
    LP.Unknown v
  | x ->
    [@inline_let] let x1 : compressionMethod = x in
    [@inline_let] let _ : squash(not (Unknown_compressionMethod? x1) ==> LP.list_mem x1 (LP.list_map fst compressionMethod_enum)) =
      _ by (LP.synth_maybe_enum_key_inv_unknown_tac x1)
    in
    LP.Known (x1 <: LP.enum_key compressionMethod_enum)

let lemma_synth_compressionMethod_inv' () : Lemma
  (LP.synth_inverse synth_compressionMethod_inv synth_compressionMethod)
= LP.forall_maybe_enum_key compressionMethod_enum (fun x -> synth_compressionMethod_inv (synth_compressionMethod x) == x)
    (_ by (LP.forall_maybe_enum_key_known_tac ()))
    (_ by (LP.forall_maybe_enum_key_unknown_tac ()))

let lemma_synth_compressionMethod_inj () : Lemma
  (LP.synth_injective synth_compressionMethod) = 
  lemma_synth_compressionMethod_inv' ();
  LP.synth_inverse_synth_injective synth_compressionMethod synth_compressionMethod_inv

#push-options "--max_ifuel 0 --initial_ifuel 0 --max_fuel 0 --max_ifuel 0"
let lemma_synth_compressionMethod_inv () : Lemma
  (LP.synth_inverse synth_compressionMethod synth_compressionMethod_inv) = allow_inversion compressionMethod; ()

#pop-options
noextract let parse_maybe_compressionMethod_key : LP.parser _ (LP.maybe_enum_key compressionMethod_enum) =
  LP.parse_maybe_enum_key compressionMethod_repr_parser compressionMethod_enum

noextract let serialize_maybe_compressionMethod_key : LP.serializer parse_maybe_compressionMethod_key =
  LP.serialize_maybe_enum_key compressionMethod_repr_parser compressionMethod_repr_serializer compressionMethod_enum

noextract let compressionMethod_parser : LP.parser _ compressionMethod =
  lemma_synth_compressionMethod_inj ();
  parse_maybe_compressionMethod_key `LP.parse_synth` synth_compressionMethod

noextract let compressionMethod_serializer : LP.serializer compressionMethod_parser =
  lemma_synth_compressionMethod_inj ();
  lemma_synth_compressionMethod_inv ();
  LP.serialize_synth _ synth_compressionMethod serialize_maybe_compressionMethod_key synth_compressionMethod_inv ()

let compressionMethod_bytesize (x:compressionMethod) : GTot nat = Seq.length (compressionMethod_serializer x)

let compressionMethod_bytesize_eq x = ()

let parse32_maybe_compressionMethod_key : LS.parser32 parse_maybe_compressionMethod_key =
  FStar.Tactics.synth_by_tactic (LS.parse32_maybe_enum_key_tac compressionMethod_repr_parser32 compressionMethod_enum)

let compressionMethod_parser32 : LS.parser32 compressionMethod_parser =
  lemma_synth_compressionMethod_inj ();
  LS.parse32_synth _ synth_compressionMethod (fun x->synth_compressionMethod x) parse32_maybe_compressionMethod_key ()

let serialize32_maybe_compressionMethod_key : LS.serializer32 serialize_maybe_compressionMethod_key =
  FStar.Tactics.synth_by_tactic (LS.serialize32_maybe_enum_key_tac
    compressionMethod_repr_serializer32 compressionMethod_enum)

let compressionMethod_serializer32 : LS.serializer32 compressionMethod_serializer =
  lemma_synth_compressionMethod_inj ();
  lemma_synth_compressionMethod_inv ();
  LS.serialize32_synth _ synth_compressionMethod _ serialize32_maybe_compressionMethod_key synth_compressionMethod_inv (fun x->synth_compressionMethod_inv x) ()

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

[@@ (LT.postprocess_with LT.pp_norm_tac) ]
inline_for_extraction let read_maybe_compressionMethod_key : LL.leaf_reader parse_maybe_compressionMethod_key =
    LL.mk_read_maybe_enum_key compressionMethod_repr_reader compressionMethod_enum

let compressionMethod_reader =
 [@inline_let] let _ = lemma_synth_compressionMethod_inj () in
 LL.read_synth' parse_maybe_compressionMethod_key synth_compressionMethod read_maybe_compressionMethod_key ()
val write_maybe_compressionMethod_key:LL.leaf_writer_strong serialize_maybe_compressionMethod_key
LowParse.Low.Base.leaf_writer_strong Parsers.CompressionMethod.serialize_maybe_compressionMethod_key