val synth_value_cases_recip_pre_intro
      (k: LP.enum_key value_kind_enum)
      (x: LP.refine_with_tag key_of_value k)
    : Lemma (synth_value_cases_recip_pre k x == true)
val synth_value_cases_recip_pre_intro
      (k: LP.enum_key value_kind_enum)
      (x: LP.refine_with_tag key_of_value k)
    : Lemma (synth_value_cases_recip_pre k x == true)
let synth_value_cases_recip_pre_intro (k:LP.enum_key value_kind_enum) (x:LP.refine_with_tag key_of_value k)
  : Lemma (synth_value_cases_recip_pre k x == true) =
  norm_spec [delta; iota] (synth_value_cases_recip_pre k x)
module Zeta.Formats.Aux.Value

(* 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 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 Zeta.Formats.Aux.Value_kind

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

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

inline_for_extraction let key_of_value (x:value) : LP.enum_key value_kind_enum =
  match x with
  | Value_payload_MV _ -> value_kind_as_enum_key MV
  | Value_payload_DVNone _ -> value_kind_as_enum_key DVNone
  | Value_payload_DVSome _ -> value_kind_as_enum_key DVSome

inline_for_extraction let value_case_of_value_kind (x:value_kind) : Type0 =
  match x with
  | MV -> mval_value
  | DVNone -> unit
  | DVSome -> application_value

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

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

inline_for_extraction let synth_value_cases (x:LP.enum_key value_kind_enum) (y:value_case_of_value_kind x)
  : LP.refine_with_tag key_of_value x =
  match x with
  | MV -> value_refine x (Value_payload_MV (to_value_case_of_value_kind MV y))
  | DVNone -> value_refine x (Value_payload_DVNone (to_value_case_of_value_kind DVNone y))
  | DVSome -> value_refine x (Value_payload_DVSome (to_value_case_of_value_kind DVSome y))

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

let synth_value_cases_recip_pre (k:LP.enum_key value_kind_enum)
  (x:LP.refine_with_tag key_of_value k) : GTot bool =
  match k with
  | MV -> Value_payload_MV? x
  | DVNone -> Value_payload_DVNone? x
  | DVSome -> Value_payload_DVSome? x
/
Zeta.Formats.Aux.Value_kind.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.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
Zeta.Formats.Aux.Value.fst

    k: LowParse.Spec.Enum.enum_key Zeta.Formats.Aux.Value_kind.value_kind_enum ->
    x: LowParse.Spec.Base.refine_with_tag Zeta.Formats.Aux.Value.key_of_value k
  -> FStar.Pervasives.Lemma (ensures Zeta.Formats.Aux.Value.synth_value_cases_recip_pre k x == true)
LowParse.Spec.Enum.enum_key Zeta.Formats.Aux.Value_kind.value_kind FStar.UInt8.t Zeta.Formats.Aux.Value_kind.value_kind_enum LowParse.Spec.Base.refine_with_tag Zeta.Formats.Aux.Value.value Zeta.Formats.Aux.Value.key_of_value FStar.Pervasives.norm_spec Prims.Cons FStar.Pervasives.norm_step FStar.Pervasives.delta FStar.Pervasives.iota Prims.Nil Prims.bool Zeta.Formats.Aux.Value.synth_value_cases_recip_pre Prims.unit Prims.l_True Prims.squash Prims.eq2 FStar.Pervasives.pattern
let synth_value_cases_recip_pre_intro
      (k: LP.enum_key value_kind_enum)
      (x: LP.refine_with_tag key_of_value k)
    : Lemma (synth_value_cases_recip_pre k x == true) =
  
norm_spec [delta; iota] (synth_value_cases_recip_pre k x)