val hkdfLabel_valid (h:HS.mem) (#rrel: _) (#rel: _) (input:LL.slice rrel rel) (pos0:U32.t) : Lemma
  (requires (
  LL.valid LPI.parse_u16 h input pos0 /\ (
  let pos1 = LL.get_valid_pos LPI.parse_u16 h input pos0 in
  LL.valid hkdfLabel_label_parser h input pos1 /\ (
  let pos2 = LL.get_valid_pos hkdfLabel_label_parser h input pos1 in
  LL.valid hkdfLabel_context_parser h input pos2 /\ (
  let pos3 = LL.get_valid_pos hkdfLabel_context_parser h input pos2 in
  True
  )))))
  (ensures (
  let length = LL.contents LPI.parse_u16 h input pos0 in
  let pos1 = LL.get_valid_pos LPI.parse_u16 h input pos0 in
  let label = LL.contents hkdfLabel_label_parser h input pos1 in
  let pos2 = LL.get_valid_pos hkdfLabel_label_parser h input pos1 in
  let context = LL.contents hkdfLabel_context_parser h input pos2 in
  let pos3 = LL.get_valid_pos hkdfLabel_context_parser h input pos2 in
  LL.valid_content_pos hkdfLabel_parser h input pos0 ({
      length = length;
      label = label;
      context = context;
    }) pos3))
val hkdfLabel_valid (h:HS.mem) (#rrel: _) (#rel: _) (input:LL.slice rrel rel) (pos0:U32.t) : Lemma
  (requires (
  LL.valid LPI.parse_u16 h input pos0 /\ (
  let pos1 = LL.get_valid_pos LPI.parse_u16 h input pos0 in
  LL.valid hkdfLabel_label_parser h input pos1 /\ (
  let pos2 = LL.get_valid_pos hkdfLabel_label_parser h input pos1 in
  LL.valid hkdfLabel_context_parser h input pos2 /\ (
  let pos3 = LL.get_valid_pos hkdfLabel_context_parser h input pos2 in
  True
  )))))
  (ensures (
  let length = LL.contents LPI.parse_u16 h input pos0 in
  let pos1 = LL.get_valid_pos LPI.parse_u16 h input pos0 in
  let label = LL.contents hkdfLabel_label_parser h input pos1 in
  let pos2 = LL.get_valid_pos hkdfLabel_label_parser h input pos1 in
  let context = LL.contents hkdfLabel_context_parser h input pos2 in
  let pos3 = LL.get_valid_pos hkdfLabel_context_parser h input pos2 in
  LL.valid_content_pos hkdfLabel_parser h input pos0 ({
      length = length;
      label = label;
      context = context;
    }) pos3))
let hkdfLabel_valid h #_ #_ input pos0 =
  let length = LL.contents LPI.parse_u16 h input pos0 in
  let pos1 = LL.get_valid_pos LPI.parse_u16 h input pos0 in
  let label = LL.contents hkdfLabel_label_parser h input pos1 in
  let pos2 = LL.get_valid_pos hkdfLabel_label_parser h input pos1 in
  let context = LL.contents hkdfLabel_context_parser h input pos2 in
  let pos3 = LL.get_valid_pos hkdfLabel_context_parser h input pos2 in
  LL.valid_nondep_then_intro h LPI.parse_u16 hkdfLabel_label_parser input pos0;
  LL.valid_nondep_then_intro h (LPI.parse_u16 `LP.nondep_then` hkdfLabel_label_parser) hkdfLabel_context_parser input pos0;
  assert_norm (hkdfLabel' == LP.get_parser_type hkdfLabel'_parser);
  assert_norm (hkdfLabel_parser_kind == hkdfLabel'_parser_kind);
  synth_hkdfLabel_injective ();
  LL.valid_synth_intro h hkdfLabel'_parser synth_hkdfLabel input pos0
module MiTLS.Parsers.HKDF.HkdfLabel

(* 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"

(* Type of field label*)
open MiTLS.Parsers.HKDF.HkdfLabel_label

(* Type of field context*)
open MiTLS.Parsers.HKDF.HkdfLabel_context

type hkdfLabel' = ((U16.t & hkdfLabel_label) & hkdfLabel_context)

inline_for_extraction let synth_hkdfLabel (x: hkdfLabel') : hkdfLabel =
  match x with ((length,label),context) -> {
    length = length;
    label = label;
    context = context;
  }

inline_for_extraction let synth_hkdfLabel_recip (x: hkdfLabel) : hkdfLabel' = ((x.length,x.label),x.context)

let synth_hkdfLabel_recip_inverse () : Lemma (LP.synth_inverse synth_hkdfLabel_recip synth_hkdfLabel) = ()

let synth_hkdfLabel_injective () : Lemma (LP.synth_injective synth_hkdfLabel) =
  LP.synth_inverse_synth_injective synth_hkdfLabel_recip synth_hkdfLabel;
  synth_hkdfLabel_recip_inverse ()

let synth_hkdfLabel_inverse () : Lemma (LP.synth_inverse synth_hkdfLabel synth_hkdfLabel_recip) =
  assert_norm (LP.synth_inverse synth_hkdfLabel synth_hkdfLabel_recip)

let synth_hkdfLabel_recip_injective () : Lemma (LP.synth_injective synth_hkdfLabel_recip) =
  synth_hkdfLabel_recip_inverse ();
  LP.synth_inverse_synth_injective synth_hkdfLabel synth_hkdfLabel_recip

noextract let hkdfLabel'_parser : LP.parser _ hkdfLabel' = ((LPI.parse_u16 `LP.nondep_then` hkdfLabel_label_parser) `LP.nondep_then` hkdfLabel_context_parser)

noextract let hkdfLabel'_parser_kind = LP.get_parser_kind hkdfLabel'_parser

let hkdfLabel_parser =
  synth_hkdfLabel_injective ();
  assert_norm (hkdfLabel_parser_kind == hkdfLabel'_parser_kind);
  hkdfLabel'_parser `LP.parse_synth` synth_hkdfLabel

noextract let hkdfLabel'_serializer : LP.serializer hkdfLabel'_parser = ((LPI.serialize_u16 `LP.serialize_nondep_then` hkdfLabel_label_serializer) `LP.serialize_nondep_then` hkdfLabel_context_serializer)

let hkdfLabel_serializer =
  [@inline_let] let _ = synth_hkdfLabel_injective () in
  [@inline_let] let _ = synth_hkdfLabel_inverse () in
  [@inline_let] let _ = assert_norm (hkdfLabel_parser_kind == hkdfLabel'_parser_kind) in
  LP.serialize_synth _ synth_hkdfLabel hkdfLabel'_serializer synth_hkdfLabel_recip ()

let hkdfLabel_bytesize (x:hkdfLabel) : GTot nat = Seq.length (hkdfLabel_serializer x)

let hkdfLabel_bytesize_eq x = ()

inline_for_extraction let hkdfLabel'_parser32 : LS.parser32 hkdfLabel'_parser = ((LS.parse32_u16 `LS.parse32_nondep_then` hkdfLabel_label_parser32) `LS.parse32_nondep_then` hkdfLabel_context_parser32)

let hkdfLabel_parser32 =
  [@inline_let] let _ = synth_hkdfLabel_injective () in
  [@inline_let] let _ = assert_norm (hkdfLabel_parser_kind == hkdfLabel'_parser_kind) in
  LS.parse32_synth _ synth_hkdfLabel (fun x -> synth_hkdfLabel x) hkdfLabel'_parser32 ()

inline_for_extraction let hkdfLabel'_serializer32 : LS.serializer32 hkdfLabel'_serializer = ((LS.serialize32_u16 `LS.serialize32_nondep_then` hkdfLabel_label_serializer32) `LS.serialize32_nondep_then` hkdfLabel_context_serializer32)

let hkdfLabel_serializer32 =
  [@inline_let] let _ = synth_hkdfLabel_injective () in
  [@inline_let] let _ = synth_hkdfLabel_inverse () in
  [@inline_let] let _ = assert_norm (hkdfLabel_parser_kind == hkdfLabel'_parser_kind) in
  LS.serialize32_synth _ synth_hkdfLabel _ hkdfLabel'_serializer32 synth_hkdfLabel_recip (fun x -> synth_hkdfLabel_recip x) ()

inline_for_extraction let hkdfLabel'_size32 : LSZ.size32 hkdfLabel'_serializer = ((LSZ.size32_u16 `LSZ.size32_nondep_then` hkdfLabel_label_size32) `LSZ.size32_nondep_then` hkdfLabel_context_size32)

let hkdfLabel_size32 =
  [@inline_let] let _ = synth_hkdfLabel_injective () in
  [@inline_let] let _ = synth_hkdfLabel_inverse () in
  [@inline_let] let _ = assert_norm (hkdfLabel_parser_kind == hkdfLabel'_parser_kind) in
  LSZ.size32_synth _ synth_hkdfLabel _ hkdfLabel'_size32 synth_hkdfLabel_recip (fun x -> synth_hkdfLabel_recip x) ()

inline_for_extraction let hkdfLabel'_validator : LL.validator hkdfLabel'_parser = (((LL.validate_u16 ()) `LL.validate_nondep_then` hkdfLabel_label_validator) `LL.validate_nondep_then` hkdfLabel_context_validator)

let hkdfLabel_validator =
  [@inline_let] let _ = synth_hkdfLabel_injective () in
  [@inline_let] let _ = assert_norm (hkdfLabel_parser_kind == hkdfLabel'_parser_kind) in
  LL.validate_synth hkdfLabel'_validator synth_hkdfLabel ()

inline_for_extraction let hkdfLabel'_jumper : LL.jumper hkdfLabel'_parser = ((LL.jump_u16 `LL.jump_nondep_then` hkdfLabel_label_jumper) `LL.jump_nondep_then` hkdfLabel_context_jumper)

let hkdfLabel_jumper =
  [@inline_let] let _ = synth_hkdfLabel_injective () in
  [@inline_let] let _ = assert_norm (hkdfLabel_parser_kind == hkdfLabel'_parser_kind) in
  LL.jump_synth hkdfLabel'_jumper synth_hkdfLabel ()

let hkdfLabel_bytesize_eqn x =
  [@inline_let] let _ = synth_hkdfLabel_injective () in
  [@inline_let] let _ = synth_hkdfLabel_inverse () in
  [@inline_let] let _ = assert_norm (hkdfLabel_parser_kind == hkdfLabel'_parser_kind) in
  LP.serialize_synth_eq _ synth_hkdfLabel hkdfLabel'_serializer synth_hkdfLabel_recip () x;
LP.length_serialize_nondep_then LPI.serialize_u16 hkdfLabel_label_serializer x.length x.label;
LP.length_serialize_nondep_then (LPI.serialize_u16 `LP.serialize_nondep_then` hkdfLabel_label_serializer) hkdfLabel_context_serializer (x.length, x.label) x.context;
  (assert (FStar.Seq.length (LP.serialize LP.serialize_u16 (x.length)) == 2));
  (hkdfLabel_label_bytesize_eq (x.label));
  (hkdfLabel_context_bytesize_eq (x.context));
  assert(hkdfLabel_bytesize x == Seq.length (LP.serialize LPI.serialize_u16 x.length) + Seq.length (LP.serialize hkdfLabel_label_serializer x.label) + Seq.length (LP.serialize hkdfLabel_context_serializer x.context))

let gaccessor'_hkdfLabel_length : LL.gaccessor hkdfLabel'_parser LPI.parse_u16 _ = (LL.gaccessor_then_fst (LL.gaccessor_then_fst (LL.gaccessor_id hkdfLabel'_parser)))

let gaccessor'_hkdfLabel_label : LL.gaccessor hkdfLabel'_parser hkdfLabel_label_parser _ = (LL.gaccessor_then_snd (LL.gaccessor_then_fst (LL.gaccessor_id hkdfLabel'_parser)))

let gaccessor'_hkdfLabel_context : LL.gaccessor hkdfLabel'_parser hkdfLabel_context_parser _ = (LL.gaccessor_then_snd (LL.gaccessor_id hkdfLabel'_parser))

inline_for_extraction noextract let accessor'_hkdfLabel_length : LL.accessor gaccessor'_hkdfLabel_length = (LL.accessor_then_fst (LL.accessor_then_fst (LL.accessor_id hkdfLabel'_parser)))

inline_for_extraction noextract let accessor'_hkdfLabel_label : LL.accessor gaccessor'_hkdfLabel_label = (LL.accessor_then_snd (LL.accessor_then_fst (LL.accessor_id hkdfLabel'_parser)) LL.jump_u16)

inline_for_extraction noextract let accessor'_hkdfLabel_context : LL.accessor gaccessor'_hkdfLabel_context = (LL.accessor_then_snd (LL.accessor_id hkdfLabel'_parser) (LL.jump_u16 `LL.jump_nondep_then` hkdfLabel_label_jumper))

noextract let clens_hkdfLabel_hkdfLabel' : LL.clens hkdfLabel hkdfLabel' = synth_hkdfLabel_recip_inverse (); synth_hkdfLabel_recip_injective (); LL.clens_synth synth_hkdfLabel_recip synth_hkdfLabel

let gaccessor_hkdfLabel_hkdfLabel' : LL.gaccessor hkdfLabel_parser hkdfLabel'_parser clens_hkdfLabel_hkdfLabel' = synth_hkdfLabel_inverse (); synth_hkdfLabel_injective (); synth_hkdfLabel_recip_inverse (); LL.gaccessor_synth hkdfLabel'_parser synth_hkdfLabel synth_hkdfLabel_recip ()

inline_for_extraction noextract let accessor_hkdfLabel_hkdfLabel' : LL.accessor gaccessor_hkdfLabel_hkdfLabel' = synth_hkdfLabel_inverse (); synth_hkdfLabel_injective (); synth_hkdfLabel_recip_inverse (); LL.accessor_synth hkdfLabel'_parser synth_hkdfLabel synth_hkdfLabel_recip ()

let gaccessor_hkdfLabel_length = LL.gaccessor_ext (gaccessor_hkdfLabel_hkdfLabel' `LL.gaccessor_compose` gaccessor'_hkdfLabel_length) clens_hkdfLabel_length ()

let accessor_hkdfLabel_length = LL.accessor_ext (LL.accessor_compose accessor_hkdfLabel_hkdfLabel' accessor'_hkdfLabel_length ()) clens_hkdfLabel_length ()

let gaccessor_hkdfLabel_label = LL.gaccessor_ext (gaccessor_hkdfLabel_hkdfLabel' `LL.gaccessor_compose` gaccessor'_hkdfLabel_label) clens_hkdfLabel_label ()

let accessor_hkdfLabel_label = LL.accessor_ext (LL.accessor_compose accessor_hkdfLabel_hkdfLabel' accessor'_hkdfLabel_label ()) clens_hkdfLabel_label ()

let gaccessor_hkdfLabel_context = LL.gaccessor_ext (gaccessor_hkdfLabel_hkdfLabel' `LL.gaccessor_compose` gaccessor'_hkdfLabel_context) clens_hkdfLabel_context ()

let accessor_hkdfLabel_context = LL.accessor_ext (LL.accessor_compose accessor_hkdfLabel_hkdfLabel' accessor'_hkdfLabel_context ()) clens_hkdfLabel_context ()
/
prims.fst.checked MiTLS.Parsers.HKDF.HkdfLabel_label.fsti.checked MiTLS.Parsers.HKDF.HkdfLabel_context.fsti.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.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.HKDF.HkdfLabel.fst
h: FStar.Monotonic.HyperStack.mem -> input: LowParse.Slice.slice rrel rel -> pos0: FStar.UInt32.t
  -> FStar.Pervasives.Lemma
      (requires
        LowParse.Low.Base.Spec.valid LowParse.Spec.Int.parse_u16 h input pos0 /\
        (let pos1 = LowParse.Low.Base.Spec.get_valid_pos LowParse.Spec.Int.parse_u16 h input pos0 in
          LowParse.Low.Base.Spec.valid MiTLS.Parsers.HKDF.HkdfLabel_label.hkdfLabel_label_parser
            h
            input
            pos1 /\
          (let pos2 =
              LowParse.Low.Base.Spec.get_valid_pos MiTLS.Parsers.HKDF.HkdfLabel_label.hkdfLabel_label_parser
                h
                input
                pos1
            in
            LowParse.Low.Base.Spec.valid MiTLS.Parsers.HKDF.HkdfLabel_context.hkdfLabel_context_parser
              h
              input
              pos2 /\
            (let pos3 =
                LowParse.Low.Base.Spec.get_valid_pos MiTLS.Parsers.HKDF.HkdfLabel_context.hkdfLabel_context_parser
                  h
                  input
                  pos2
              in
              Prims.l_True))))
      (ensures
        (let length = LowParse.Low.Base.Spec.contents LowParse.Spec.Int.parse_u16 h input pos0 in
          let pos1 =
            LowParse.Low.Base.Spec.get_valid_pos LowParse.Spec.Int.parse_u16 h input pos0
          in
          let label =
            LowParse.Low.Base.Spec.contents MiTLS.Parsers.HKDF.HkdfLabel_label.hkdfLabel_label_parser
              h
              input
              pos1
          in
          let pos2 =
            LowParse.Low.Base.Spec.get_valid_pos MiTLS.Parsers.HKDF.HkdfLabel_label.hkdfLabel_label_parser
              h
              input
              pos1
          in
          let context =
            LowParse.Low.Base.Spec.contents MiTLS.Parsers.HKDF.HkdfLabel_context.hkdfLabel_context_parser
              h
              input
              pos2
          in
          let pos3 =
            LowParse.Low.Base.Spec.get_valid_pos MiTLS.Parsers.HKDF.HkdfLabel_context.hkdfLabel_context_parser
              h
              input
              pos2
          in
          LowParse.Low.Base.Spec.valid_content_pos MiTLS.Parsers.HKDF.HkdfLabel.hkdfLabel_parser
            h
            input
            pos0
            (MiTLS.Parsers.HKDF.HkdfLabel.MkhkdfLabel length label context)
            pos3))
FStar.Monotonic.HyperStack.mem LowParse.Slice.srel LowParse.Bytes.byte LowParse.Slice.slice FStar.UInt32.t LowParse.Low.Combinators.valid_synth_intro LowParse.Spec.Combinators.and_then_kind LowParse.Spec.Int.parse_u16_kind MiTLS.Parsers.HKDF.HkdfLabel_label.hkdfLabel_label_parser_kind MiTLS.Parsers.HKDF.HkdfLabel_context.hkdfLabel_context_parser_kind MiTLS.Parsers.HKDF.HkdfLabel.hkdfLabel' MiTLS.Parsers.HKDF.HkdfLabel.hkdfLabel MiTLS.Parsers.HKDF.HkdfLabel.hkdfLabel'_parser MiTLS.Parsers.HKDF.HkdfLabel.synth_hkdfLabel Prims.unit MiTLS.Parsers.HKDF.HkdfLabel.synth_hkdfLabel_injective FStar.Pervasives.assert_norm Prims.eq2 LowParse.Spec.Base.parser_kind MiTLS.Parsers.HKDF.HkdfLabel.hkdfLabel_parser_kind MiTLS.Parsers.HKDF.HkdfLabel.hkdfLabel'_parser_kind LowParse.Spec.Base.get_parser_type LowParse.Low.Combinators.valid_nondep_then_intro FStar.Pervasives.Native.tuple2 FStar.UInt16.t MiTLS.Parsers.HKDF.HkdfLabel_label.hkdfLabel_label LowParse.Spec.Combinators.nondep_then LowParse.Spec.Int.parse_u16 MiTLS.Parsers.HKDF.HkdfLabel_label.hkdfLabel_label_parser MiTLS.Parsers.HKDF.HkdfLabel_context.hkdfLabel_context MiTLS.Parsers.HKDF.HkdfLabel_context.hkdfLabel_context_parser LowParse.Low.Base.Spec.get_valid_pos LowParse.Low.Base.Spec.contents
let hkdfLabel_valid h #_ #_ input pos0 =
  
let length = LL.contents LPI.parse_u16 h input pos0 in
let pos1 = LL.get_valid_pos LPI.parse_u16 h input pos0 in
let label = LL.contents hkdfLabel_label_parser h input pos1 in
let pos2 = LL.get_valid_pos hkdfLabel_label_parser h input pos1 in
let context = LL.contents hkdfLabel_context_parser h input pos2 in
let pos3 = LL.get_valid_pos hkdfLabel_context_parser h input pos2 in
LL.valid_nondep_then_intro h LPI.parse_u16 hkdfLabel_label_parser input pos0;
LL.valid_nondep_then_intro h
  (LPI.parse_u16 `LP.nondep_then` hkdfLabel_label_parser)
  hkdfLabel_context_parser
  input
  pos0;
assert_norm (hkdfLabel' == LP.get_parser_type hkdfLabel'_parser);
assert_norm (hkdfLabel_parser_kind == hkdfLabel'_parser_kind);
synth_hkdfLabel_injective ();
LL.valid_synth_intro h hkdfLabel'_parser synth_hkdfLabel input pos0