val internal_key_validator: LL.validator internal_key_parser
val internal_key_validator: LL.validator internal_key_parser
let internal_key_validator =
  LL.validate_synth
    #_ #_ #_
    #(LP.parse_filter base_key_parser internal_key_filter)
    (fun sl pos ->
      let h = HST.get () in
      LL.valid_filter h base_key_parser internal_key_filter sl (LL.uint64_to_uint32 pos);
      let res = base_key_validator sl pos in
      if LL.is_error res
      then res
      else
        let bk = Zeta.Formats.Aux.Base_key.base_key_reader sl (LL.uint64_to_uint32 pos) in
        if Zeta.Steel.KeyUtils.is_internal_key bk
        then res
        else LL.validator_error_generic
    )
    internal_key_synth
    ()
module Zeta.Formats.Aux.Internal_key

module U8 = FStar.UInt8
module U16 = FStar.UInt16
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module LP = LowParse.Spec
module LS = 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

friend Zeta.Formats.Aux.External
open Zeta.Formats.Aux.External
open Zeta.Formats.Aux.Base_key

inline_for_extraction
noextract
let internal_key_filter
  (x: base_key)
: Tot bool
= Zeta.Steel.KeyUtils.is_internal_key x

inline_for_extraction
noextract
let internal_key_synth
  (x: LP.parse_filter_refine internal_key_filter)
: Tot internal_key
= x

inline_for_extraction
noextract
let internal_key_synth_recip
  (x: internal_key)
: Tot (LP.parse_filter_refine internal_key_filter)
= x

open Zeta.Formats.Aux.Base_key

let internal_key_parser =
  LP.parse_synth
    (LP.parse_filter base_key_parser internal_key_filter)
    internal_key_synth

let internal_key_serializer =
  LP.serialize_synth
    _
    _
    (LP.serialize_filter base_key_serializer internal_key_filter)
    internal_key_synth_recip
    ()

let internal_key_bytesize x = base_key_bytesize (internal_key_synth_recip x)

let internal_key_bytesize_eq x =
  LP.serialize_synth_eq _ internal_key_synth (LP.serialize_filter base_key_serializer internal_key_filter)
    internal_key_synth_recip
    () x;
  base_key_bytesize_eq (internal_key_synth_recip x)

let internal_key_size32 =
  LS.size32_synth'
    _
    _
    _
    (LS.size32_filter base_key_size32 _)
    _
    ()
/
Zeta.Steel.KeyUtils.fsti.checked Zeta.Formats.Aux.External.fst.checked Zeta.Formats.Aux.Base_key.fsti.checked prims.fst.checked LowStar.Buffer.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.Pervasives.fsti.checked FStar.List.Tot.fst.checked FStar.HyperStack.ST.fsti.checked FStar.HyperStack.fst.checked FStar.Bytes.fsti.checked
Zeta.Formats.Aux.Internal_key.fst
LowParse.Low.Base.validator Zeta.Formats.Aux.Internal_key.internal_key_parser
LowParse.Low.Combinators.validate_synth LowParse.Spec.Combinators.parse_filter_kind Zeta.Formats.Aux.Base_key.base_key_parser_kind LowParse.Spec.Combinators.parse_filter_refine Zeta.Formats.Aux.Base_key.base_key Zeta.Formats.Aux.Internal_key.internal_key_filter Zeta.Formats.Aux.External.internal_key LowParse.Spec.Combinators.parse_filter Zeta.Formats.Aux.Base_key.base_key_parser LowParse.Slice.srel LowParse.Bytes.byte LowParse.Slice.slice FStar.UInt64.t LowParse.Low.ErrorCode.is_error Prims.bool Zeta.Steel.KeyUtils.is_internal_key LowParse.Low.ErrorCode.validator_error_generic Zeta.Formats.Aux.Base_key.base_key_reader LowParse.Low.ErrorCode.uint64_to_uint32 Zeta.Formats.Aux.Base_key.base_key_validator Prims.unit LowParse.Low.Combinators.valid_filter FStar.Monotonic.HyperStack.mem FStar.HyperStack.ST.get Zeta.Formats.Aux.Internal_key.internal_key_synth
let internal_key_validator =
  
LL.validate_synth #_
  #_
  #_
  #(LP.parse_filter base_key_parser internal_key_filter)
  (fun sl pos ->
      let h = HST.get () in
      LL.valid_filter h base_key_parser internal_key_filter sl (LL.uint64_to_uint32 pos);
      let res = base_key_validator sl pos in
      if LL.is_error res
      then res
      else
        let bk = Zeta.Formats.Aux.Base_key.base_key_reader sl (LL.uint64_to_uint32 pos) in
        if Zeta.Steel.KeyUtils.is_internal_key bk then res else LL.validator_error_generic)
  internal_key_synth
  ()