val synth_descendent_hash_cases_recip
      (k: LP.enum_key voption_enum)
      (x: LP.refine_with_tag key_of_descendent_hash k)
    : (descendent_hash_case_of_voption k)
val synth_descendent_hash_cases_recip
      (k: LP.enum_key voption_enum)
      (x: LP.refine_with_tag key_of_descendent_hash k)
    : (descendent_hash_case_of_voption k)
let synth_descendent_hash_cases_recip (k:LP.enum_key voption_enum)
  (x:LP.refine_with_tag key_of_descendent_hash k) : (descendent_hash_case_of_voption k) =
  match k with
  | Vnone -> [@inline_let] let _ = synth_descendent_hash_cases_recip_pre_intro Vnone x in
    (match x with Dh_vnone y -> (from_descendent_hash_case_of_voption Vnone y))
  | Vsome -> [@inline_let] let _ = synth_descendent_hash_cases_recip_pre_intro Vsome x in
    (match x with Dh_vsome y -> (from_descendent_hash_case_of_voption Vsome y))
module Zeta.Formats.Aux.Descendent_hash

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

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

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

inline_for_extraction let key_of_descendent_hash (x:descendent_hash) : LP.enum_key voption_enum =
  match x with
  | Dh_vnone _ -> voption_as_enum_key Vnone
  | Dh_vsome _ -> voption_as_enum_key Vsome

inline_for_extraction let descendent_hash_case_of_voption (x:voption) : Type0 =
  match x with
  | Vnone -> unit
  | Vsome -> descendent_hash_desc

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

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

inline_for_extraction let synth_descendent_hash_cases (x:LP.enum_key voption_enum) (y:descendent_hash_case_of_voption x)
  : LP.refine_with_tag key_of_descendent_hash x =
  match x with
  | Vnone -> descendent_hash_refine x (Dh_vnone (to_descendent_hash_case_of_voption Vnone y))
  | Vsome -> descendent_hash_refine x (Dh_vsome (to_descendent_hash_case_of_voption Vsome y))

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

let synth_descendent_hash_cases_recip_pre (k:LP.enum_key voption_enum)
  (x:LP.refine_with_tag key_of_descendent_hash k) : GTot bool =
  match k with
  | Vnone -> Dh_vnone? x
  | Vsome -> Dh_vsome? x

let synth_descendent_hash_cases_recip_pre_intro (k:LP.enum_key voption_enum) (x:LP.refine_with_tag key_of_descendent_hash k)
  : Lemma (synth_descendent_hash_cases_recip_pre k x == true) =
  norm_spec [delta; iota] (synth_descendent_hash_cases_recip_pre k x)
/
Zeta.Formats.Aux.Voption.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.Descendent_hash.fst

    k: LowParse.Spec.Enum.enum_key Zeta.Formats.Aux.Voption.voption_enum ->
    x: LowParse.Spec.Base.refine_with_tag Zeta.Formats.Aux.Descendent_hash.key_of_descendent_hash k
  -> Zeta.Formats.Aux.Descendent_hash.descendent_hash_case_of_voption k
LowParse.Spec.Enum.enum_key Zeta.Formats.Aux.Voption.voption FStar.UInt8.t Zeta.Formats.Aux.Voption.voption_enum LowParse.Spec.Base.refine_with_tag Zeta.Formats.Aux.Descendent_hash.descendent_hash Zeta.Formats.Aux.Descendent_hash.key_of_descendent_hash Prims.unit Zeta.Formats.Aux.Descendent_hash.from_descendent_hash_case_of_voption Zeta.Formats.Aux.Voption.Vnone Zeta.Formats.Aux.Descendent_hash.descendent_hash_case_of_voption Zeta.Formats.Aux.Descendent_hash.synth_descendent_hash_cases_recip_pre_intro Zeta.Formats.Aux.Descendent_hash_desc.descendent_hash_desc Zeta.Formats.Aux.Voption.Vsome
let synth_descendent_hash_cases_recip
      (k: LP.enum_key voption_enum)
      (x: LP.refine_with_tag key_of_descendent_hash k)
    : (descendent_hash_case_of_voption k) =
  
match k with
| Vnone ->
  [@@ inline_let ]let _ = synth_descendent_hash_cases_recip_pre_intro Vnone x in
  (match x with | Dh_vnone y -> (from_descendent_hash_case_of_voption Vnone y))
| Vsome ->
  [@@ inline_let ]let _ = synth_descendent_hash_cases_recip_pre_intro Vsome x in
  (match x with | Dh_vsome y -> (from_descendent_hash_case_of_voption Vsome y))