val pskIdentity_valid (h:HS.mem) (#rrel: _) (#rel: _) (input:LL.slice rrel rel) (pos0:U32.t) : Lemma
  (requires (
  LL.valid pskIdentity_identity_parser h input pos0 /\ (
  let pos1 = LL.get_valid_pos pskIdentity_identity_parser h input pos0 in
  LL.valid LPI.parse_u32 h input pos1 /\ (
  let pos2 = LL.get_valid_pos LPI.parse_u32 h input pos1 in
  True
  ))))
  (ensures (
  let identity = LL.contents pskIdentity_identity_parser h input pos0 in
  let pos1 = LL.get_valid_pos pskIdentity_identity_parser h input pos0 in
  let obfuscated_ticket_age = LL.contents LPI.parse_u32 h input pos1 in
  let pos2 = LL.get_valid_pos LPI.parse_u32 h input pos1 in
  LL.valid_content_pos pskIdentity_parser h input pos0 ({
      identity = identity;
      obfuscated_ticket_age = obfuscated_ticket_age;
    }) pos2))
val pskIdentity_valid (h:HS.mem) (#rrel: _) (#rel: _) (input:LL.slice rrel rel) (pos0:U32.t) : Lemma
  (requires (
  LL.valid pskIdentity_identity_parser h input pos0 /\ (
  let pos1 = LL.get_valid_pos pskIdentity_identity_parser h input pos0 in
  LL.valid LPI.parse_u32 h input pos1 /\ (
  let pos2 = LL.get_valid_pos LPI.parse_u32 h input pos1 in
  True
  ))))
  (ensures (
  let identity = LL.contents pskIdentity_identity_parser h input pos0 in
  let pos1 = LL.get_valid_pos pskIdentity_identity_parser h input pos0 in
  let obfuscated_ticket_age = LL.contents LPI.parse_u32 h input pos1 in
  let pos2 = LL.get_valid_pos LPI.parse_u32 h input pos1 in
  LL.valid_content_pos pskIdentity_parser h input pos0 ({
      identity = identity;
      obfuscated_ticket_age = obfuscated_ticket_age;
    }) pos2))
let pskIdentity_valid h #_ #_ input pos0 =
  let identity = LL.contents pskIdentity_identity_parser h input pos0 in
  let pos1 = LL.get_valid_pos pskIdentity_identity_parser h input pos0 in
  let obfuscated_ticket_age = LL.contents LPI.parse_u32 h input pos1 in
  let pos2 = LL.get_valid_pos LPI.parse_u32 h input pos1 in
  LL.valid_nondep_then_intro h pskIdentity_identity_parser LPI.parse_u32 input pos0;
  assert_norm (pskIdentity' == LP.get_parser_type pskIdentity'_parser);
  assert_norm (pskIdentity_parser_kind == pskIdentity'_parser_kind);
  synth_pskIdentity_injective ();
  LL.valid_synth_intro h pskIdentity'_parser synth_pskIdentity input pos0
module MiTLS.Parsers.PskIdentity

(* 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 identity*)
open MiTLS.Parsers.PskIdentity_identity

type pskIdentity' = (pskIdentity_identity & U32.t)

inline_for_extraction let synth_pskIdentity (x: pskIdentity') : pskIdentity =
  match x with (identity,obfuscated_ticket_age) -> {
    identity = identity;
    obfuscated_ticket_age = obfuscated_ticket_age;
  }

inline_for_extraction let synth_pskIdentity_recip (x: pskIdentity) : pskIdentity' = (x.identity,x.obfuscated_ticket_age)

let synth_pskIdentity_recip_inverse () : Lemma (LP.synth_inverse synth_pskIdentity_recip synth_pskIdentity) = ()

let synth_pskIdentity_injective () : Lemma (LP.synth_injective synth_pskIdentity) =
  LP.synth_inverse_synth_injective synth_pskIdentity_recip synth_pskIdentity;
  synth_pskIdentity_recip_inverse ()

let synth_pskIdentity_inverse () : Lemma (LP.synth_inverse synth_pskIdentity synth_pskIdentity_recip) =
  assert_norm (LP.synth_inverse synth_pskIdentity synth_pskIdentity_recip)

let synth_pskIdentity_recip_injective () : Lemma (LP.synth_injective synth_pskIdentity_recip) =
  synth_pskIdentity_recip_inverse ();
  LP.synth_inverse_synth_injective synth_pskIdentity synth_pskIdentity_recip

noextract let pskIdentity'_parser : LP.parser _ pskIdentity' = (pskIdentity_identity_parser `LP.nondep_then` LPI.parse_u32)

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

let pskIdentity_parser =
  synth_pskIdentity_injective ();
  assert_norm (pskIdentity_parser_kind == pskIdentity'_parser_kind);
  pskIdentity'_parser `LP.parse_synth` synth_pskIdentity

noextract let pskIdentity'_serializer : LP.serializer pskIdentity'_parser = (pskIdentity_identity_serializer `LP.serialize_nondep_then` LPI.serialize_u32)

let pskIdentity_serializer =
  [@inline_let] let _ = synth_pskIdentity_injective () in
  [@inline_let] let _ = synth_pskIdentity_inverse () in
  [@inline_let] let _ = assert_norm (pskIdentity_parser_kind == pskIdentity'_parser_kind) in
  LP.serialize_synth _ synth_pskIdentity pskIdentity'_serializer synth_pskIdentity_recip ()

let pskIdentity_bytesize (x:pskIdentity) : GTot nat = Seq.length (pskIdentity_serializer x)

let pskIdentity_bytesize_eq x = ()

inline_for_extraction let pskIdentity'_parser32 : LS.parser32 pskIdentity'_parser = (pskIdentity_identity_parser32 `LS.parse32_nondep_then` LS.parse32_u32)

let pskIdentity_parser32 =
  [@inline_let] let _ = synth_pskIdentity_injective () in
  [@inline_let] let _ = assert_norm (pskIdentity_parser_kind == pskIdentity'_parser_kind) in
  LS.parse32_synth _ synth_pskIdentity (fun x -> synth_pskIdentity x) pskIdentity'_parser32 ()

inline_for_extraction let pskIdentity'_serializer32 : LS.serializer32 pskIdentity'_serializer = (pskIdentity_identity_serializer32 `LS.serialize32_nondep_then` LS.serialize32_u32)

let pskIdentity_serializer32 =
  [@inline_let] let _ = synth_pskIdentity_injective () in
  [@inline_let] let _ = synth_pskIdentity_inverse () in
  [@inline_let] let _ = assert_norm (pskIdentity_parser_kind == pskIdentity'_parser_kind) in
  LS.serialize32_synth _ synth_pskIdentity _ pskIdentity'_serializer32 synth_pskIdentity_recip (fun x -> synth_pskIdentity_recip x) ()

inline_for_extraction let pskIdentity'_size32 : LSZ.size32 pskIdentity'_serializer = (pskIdentity_identity_size32 `LSZ.size32_nondep_then` LSZ.size32_u32)

let pskIdentity_size32 =
  [@inline_let] let _ = synth_pskIdentity_injective () in
  [@inline_let] let _ = synth_pskIdentity_inverse () in
  [@inline_let] let _ = assert_norm (pskIdentity_parser_kind == pskIdentity'_parser_kind) in
  LSZ.size32_synth _ synth_pskIdentity _ pskIdentity'_size32 synth_pskIdentity_recip (fun x -> synth_pskIdentity_recip x) ()

inline_for_extraction let pskIdentity'_validator : LL.validator pskIdentity'_parser = (pskIdentity_identity_validator `LL.validate_nondep_then` (LL.validate_u32 ()))

let pskIdentity_validator =
  [@inline_let] let _ = synth_pskIdentity_injective () in
  [@inline_let] let _ = assert_norm (pskIdentity_parser_kind == pskIdentity'_parser_kind) in
  LL.validate_synth pskIdentity'_validator synth_pskIdentity ()

inline_for_extraction let pskIdentity'_jumper : LL.jumper pskIdentity'_parser = (pskIdentity_identity_jumper `LL.jump_nondep_then` LL.jump_u32)

let pskIdentity_jumper =
  [@inline_let] let _ = synth_pskIdentity_injective () in
  [@inline_let] let _ = assert_norm (pskIdentity_parser_kind == pskIdentity'_parser_kind) in
  LL.jump_synth pskIdentity'_jumper synth_pskIdentity ()

let pskIdentity_bytesize_eqn x =
  [@inline_let] let _ = synth_pskIdentity_injective () in
  [@inline_let] let _ = synth_pskIdentity_inverse () in
  [@inline_let] let _ = assert_norm (pskIdentity_parser_kind == pskIdentity'_parser_kind) in
  LP.serialize_synth_eq _ synth_pskIdentity pskIdentity'_serializer synth_pskIdentity_recip () x;
LP.length_serialize_nondep_then pskIdentity_identity_serializer LPI.serialize_u32 x.identity x.obfuscated_ticket_age;
  (pskIdentity_identity_bytesize_eq (x.identity));
  (assert (FStar.Seq.length (LP.serialize LP.serialize_u32 (x.obfuscated_ticket_age)) == 4));
  assert(pskIdentity_bytesize x == Seq.length (LP.serialize pskIdentity_identity_serializer x.identity) + Seq.length (LP.serialize LPI.serialize_u32 x.obfuscated_ticket_age))

let gaccessor'_pskIdentity_identity : LL.gaccessor pskIdentity'_parser pskIdentity_identity_parser _ = (LL.gaccessor_then_fst (LL.gaccessor_id pskIdentity'_parser))

let gaccessor'_pskIdentity_obfuscated_ticket_age : LL.gaccessor pskIdentity'_parser LPI.parse_u32 _ = (LL.gaccessor_then_snd (LL.gaccessor_id pskIdentity'_parser))

inline_for_extraction noextract let accessor'_pskIdentity_identity : LL.accessor gaccessor'_pskIdentity_identity = (LL.accessor_then_fst (LL.accessor_id pskIdentity'_parser))

inline_for_extraction noextract let accessor'_pskIdentity_obfuscated_ticket_age : LL.accessor gaccessor'_pskIdentity_obfuscated_ticket_age = (LL.accessor_then_snd (LL.accessor_id pskIdentity'_parser) pskIdentity_identity_jumper)

noextract let clens_pskIdentity_pskIdentity' : LL.clens pskIdentity pskIdentity' = synth_pskIdentity_recip_inverse (); synth_pskIdentity_recip_injective (); LL.clens_synth synth_pskIdentity_recip synth_pskIdentity

let gaccessor_pskIdentity_pskIdentity' : LL.gaccessor pskIdentity_parser pskIdentity'_parser clens_pskIdentity_pskIdentity' = synth_pskIdentity_inverse (); synth_pskIdentity_injective (); synth_pskIdentity_recip_inverse (); LL.gaccessor_synth pskIdentity'_parser synth_pskIdentity synth_pskIdentity_recip ()

inline_for_extraction noextract let accessor_pskIdentity_pskIdentity' : LL.accessor gaccessor_pskIdentity_pskIdentity' = synth_pskIdentity_inverse (); synth_pskIdentity_injective (); synth_pskIdentity_recip_inverse (); LL.accessor_synth pskIdentity'_parser synth_pskIdentity synth_pskIdentity_recip ()

let gaccessor_pskIdentity_identity = LL.gaccessor_ext (gaccessor_pskIdentity_pskIdentity' `LL.gaccessor_compose` gaccessor'_pskIdentity_identity) clens_pskIdentity_identity ()

let accessor_pskIdentity_identity = LL.accessor_ext (LL.accessor_compose accessor_pskIdentity_pskIdentity' accessor'_pskIdentity_identity ()) clens_pskIdentity_identity ()

let gaccessor_pskIdentity_obfuscated_ticket_age = LL.gaccessor_ext (gaccessor_pskIdentity_pskIdentity' `LL.gaccessor_compose` gaccessor'_pskIdentity_obfuscated_ticket_age) clens_pskIdentity_obfuscated_ticket_age ()

let accessor_pskIdentity_obfuscated_ticket_age = LL.accessor_ext (LL.accessor_compose accessor_pskIdentity_pskIdentity' accessor'_pskIdentity_obfuscated_ticket_age ()) clens_pskIdentity_obfuscated_ticket_age ()
/
prims.fst.checked MiTLS.Parsers.PskIdentity_identity.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.PskIdentity.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 MiTLS.Parsers.PskIdentity_identity.pskIdentity_identity_parser
          h
          input
          pos0 /\
        (let pos1 =
            LowParse.Low.Base.Spec.get_valid_pos MiTLS.Parsers.PskIdentity_identity.pskIdentity_identity_parser
              h
              input
              pos0
          in
          LowParse.Low.Base.Spec.valid LowParse.Spec.Int.parse_u32 h input pos1 /\
          (let pos2 =
              LowParse.Low.Base.Spec.get_valid_pos LowParse.Spec.Int.parse_u32 h input pos1
            in
            Prims.l_True)))
      (ensures
        (let identity =
            LowParse.Low.Base.Spec.contents MiTLS.Parsers.PskIdentity_identity.pskIdentity_identity_parser
              h
              input
              pos0
          in
          let pos1 =
            LowParse.Low.Base.Spec.get_valid_pos MiTLS.Parsers.PskIdentity_identity.pskIdentity_identity_parser
              h
              input
              pos0
          in
          let obfuscated_ticket_age =
            LowParse.Low.Base.Spec.contents LowParse.Spec.Int.parse_u32 h input pos1
          in
          let pos2 =
            LowParse.Low.Base.Spec.get_valid_pos LowParse.Spec.Int.parse_u32 h input pos1
          in
          LowParse.Low.Base.Spec.valid_content_pos MiTLS.Parsers.PskIdentity.pskIdentity_parser
            h
            input
            pos0
            (MiTLS.Parsers.PskIdentity.MkpskIdentity identity obfuscated_ticket_age)
            pos2))
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 MiTLS.Parsers.PskIdentity_identity.pskIdentity_identity_parser_kind LowParse.Spec.Int.parse_u32_kind MiTLS.Parsers.PskIdentity.pskIdentity' MiTLS.Parsers.PskIdentity.pskIdentity MiTLS.Parsers.PskIdentity.pskIdentity'_parser MiTLS.Parsers.PskIdentity.synth_pskIdentity Prims.unit MiTLS.Parsers.PskIdentity.synth_pskIdentity_injective FStar.Pervasives.assert_norm Prims.eq2 LowParse.Spec.Base.parser_kind MiTLS.Parsers.PskIdentity.pskIdentity_parser_kind MiTLS.Parsers.PskIdentity.pskIdentity'_parser_kind LowParse.Spec.Base.get_parser_type LowParse.Low.Combinators.valid_nondep_then_intro MiTLS.Parsers.PskIdentity_identity.pskIdentity_identity MiTLS.Parsers.PskIdentity_identity.pskIdentity_identity_parser LowParse.Spec.Int.parse_u32 LowParse.Low.Base.Spec.get_valid_pos LowParse.Low.Base.Spec.contents
let pskIdentity_valid h #_ #_ input pos0 =
  
let identity = LL.contents pskIdentity_identity_parser h input pos0 in
let pos1 = LL.get_valid_pos pskIdentity_identity_parser h input pos0 in
let obfuscated_ticket_age = LL.contents LPI.parse_u32 h input pos1 in
let pos2 = LL.get_valid_pos LPI.parse_u32 h input pos1 in
LL.valid_nondep_then_intro h pskIdentity_identity_parser LPI.parse_u32 input pos0;
assert_norm (pskIdentity' == LP.get_parser_type pskIdentity'_parser);
assert_norm (pskIdentity_parser_kind == pskIdentity'_parser_kind);
synth_pskIdentity_injective ();
LL.valid_synth_intro h pskIdentity'_parser synth_pskIdentity input pos0