val heartbeatMode_serializer32: LS.serializer32 heartbeatMode_serializer
val heartbeatMode_serializer32: LS.serializer32 heartbeatMode_serializer
let heartbeatMode_serializer32 : LS.serializer32 heartbeatMode_serializer =
  lemma_synth_heartbeatMode_inj ();
  lemma_synth_heartbeatMode_inv ();
  LS.serialize32_synth _ synth_heartbeatMode _ serialize32_maybe_heartbeatMode_key synth_heartbeatMode_inv (fun x->synth_heartbeatMode_inv x) ()
module MiTLS.Parsers.HeartbeatMode

(* 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 heartbeatMode_enum : LP.enum heartbeatMode U8.t =
  [@inline_let] let e = [
    Peer_allowed_to_send, 1z;
    Peer_not_allowed_to_send, 2z;
  ] 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 heartbeatMode_repr_parser = LPI.parse_u8

noextract let heartbeatMode_repr_serializer = LPI.serialize_u8

inline_for_extraction noextract let heartbeatMode_repr_parser32 = LS.parse32_u8

inline_for_extraction noextract let heartbeatMode_repr_serializer32 = LS.serialize32_u8

inline_for_extraction noextract let heartbeatMode_repr_size32 = LSZ.size32_u8

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

inline_for_extraction noextract let heartbeatMode_repr_jumper = LL.jump_u8

inline_for_extraction noextract let heartbeatMode_repr_reader = LL.read_u8

inline_for_extraction noextract let heartbeatMode_repr_writer = LL.write_u8

inline_for_extraction let synth_heartbeatMode (x:LP.maybe_enum_key heartbeatMode_enum) : heartbeatMode = 
  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 heartbeatMode_enum) == known_heartbeatMode_repr v) in
    Unknown_heartbeatMode v

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

let lemma_synth_heartbeatMode_inv' () : Lemma
  (LP.synth_inverse synth_heartbeatMode_inv synth_heartbeatMode)
= LP.forall_maybe_enum_key heartbeatMode_enum (fun x -> synth_heartbeatMode_inv (synth_heartbeatMode x) == x)
    (_ by (LP.forall_maybe_enum_key_known_tac ()))
    (_ by (LP.forall_maybe_enum_key_unknown_tac ()))

let lemma_synth_heartbeatMode_inj () : Lemma
  (LP.synth_injective synth_heartbeatMode) = 
  lemma_synth_heartbeatMode_inv' ();
  LP.synth_inverse_synth_injective synth_heartbeatMode synth_heartbeatMode_inv

#push-options "--max_ifuel 0 --initial_ifuel 0 --max_fuel 0 --max_ifuel 0"
let lemma_synth_heartbeatMode_inv () : Lemma
  (LP.synth_inverse synth_heartbeatMode synth_heartbeatMode_inv) = allow_inversion heartbeatMode; ()

#pop-options
noextract let parse_maybe_heartbeatMode_key : LP.parser _ (LP.maybe_enum_key heartbeatMode_enum) =
  LP.parse_maybe_enum_key heartbeatMode_repr_parser heartbeatMode_enum

noextract let serialize_maybe_heartbeatMode_key : LP.serializer parse_maybe_heartbeatMode_key =
  LP.serialize_maybe_enum_key heartbeatMode_repr_parser heartbeatMode_repr_serializer heartbeatMode_enum

noextract let heartbeatMode_parser : LP.parser _ heartbeatMode =
  lemma_synth_heartbeatMode_inj ();
  parse_maybe_heartbeatMode_key `LP.parse_synth` synth_heartbeatMode

noextract let heartbeatMode_serializer : LP.serializer heartbeatMode_parser =
  lemma_synth_heartbeatMode_inj ();
  lemma_synth_heartbeatMode_inv ();
  LP.serialize_synth _ synth_heartbeatMode serialize_maybe_heartbeatMode_key synth_heartbeatMode_inv ()

let heartbeatMode_bytesize (x:heartbeatMode) : GTot nat = Seq.length (heartbeatMode_serializer x)

let heartbeatMode_bytesize_eq x = ()

let parse32_maybe_heartbeatMode_key : LS.parser32 parse_maybe_heartbeatMode_key =
  FStar.Tactics.synth_by_tactic (LS.parse32_maybe_enum_key_tac heartbeatMode_repr_parser32 heartbeatMode_enum)

let heartbeatMode_parser32 : LS.parser32 heartbeatMode_parser =
  lemma_synth_heartbeatMode_inj ();
  LS.parse32_synth _ synth_heartbeatMode (fun x->synth_heartbeatMode x) parse32_maybe_heartbeatMode_key ()

let serialize32_maybe_heartbeatMode_key : LS.serializer32 serialize_maybe_heartbeatMode_key =
  FStar.Tactics.synth_by_tactic (LS.serialize32_maybe_enum_key_tac
    heartbeatMode_repr_serializer32 heartbeatMode_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.HeartbeatMode.fst
LowParse.SLow.Base.serializer32 MiTLS.Parsers.HeartbeatMode.heartbeatMode_serializer
LowParse.SLow.Combinators.serialize32_synth LowParse.Spec.Int.parse_u8_kind LowParse.Spec.Enum.maybe_enum_key MiTLS.Parsers.HeartbeatMode.heartbeatMode FStar.UInt8.t MiTLS.Parsers.HeartbeatMode.heartbeatMode_enum MiTLS.Parsers.HeartbeatMode.parse_maybe_heartbeatMode_key MiTLS.Parsers.HeartbeatMode.synth_heartbeatMode MiTLS.Parsers.HeartbeatMode.serialize_maybe_heartbeatMode_key MiTLS.Parsers.HeartbeatMode.serialize32_maybe_heartbeatMode_key MiTLS.Parsers.HeartbeatMode.synth_heartbeatMode_inv Prims.eq2 Prims.unit MiTLS.Parsers.HeartbeatMode.lemma_synth_heartbeatMode_inv MiTLS.Parsers.HeartbeatMode.lemma_synth_heartbeatMode_inj LowParse.SLow.Base.serializer32 MiTLS.Parsers.HeartbeatMode.heartbeatMode_parser_kind MiTLS.Parsers.HeartbeatMode.heartbeatMode_parser MiTLS.Parsers.HeartbeatMode.heartbeatMode_serializer
let heartbeatMode_serializer32:LS.serializer32 heartbeatMode_serializer =
  
lemma_synth_heartbeatMode_inj ();
lemma_synth_heartbeatMode_inv ();
LS.serialize32_synth _
  synth_heartbeatMode
  _
  serialize32_maybe_heartbeatMode_key
  synth_heartbeatMode_inv
  (fun x -> synth_heartbeatMode_inv x)
  ()