val namedGroup_bytesize (x:namedGroup) : GTot nat
let namedGroup_bytesize (x:namedGroup) : GTot nat = Seq.length (namedGroup_serializer x)
val namedGroup_bytesize (x:namedGroup) : GTot nat
let namedGroup_bytesize (x: namedGroup) : GTot nat =
Seq.length (namedGroup_serializer x)
Parsers.NamedGroup.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.Tactics.fst.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
Parsers.NamedGroup.fst
Parsers.NamedGroup.namedGroup FStar.Seq.Base.length LowParse.Bytes.byte Parsers.NamedGroup.namedGroup_serializer Prims.nat
module Parsers.NamedGroup

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

[@LT.Norm] inline_for_extraction let namedGroup_enum : LP.enum namedGroup U16.t =
  [@inline_let] let e = [
    Sect233k1, 6us;
    Sect233r1, 7us;
    Sect239k1, 8us;
    Sect283k1, 9us;
    Sect283r1, 10us;
    Sect409k1, 11us;
    Sect409r1, 12us;
    Sect571k1, 13us;
    Sect571r1, 14us;
    Secp224k1, 20us;
    Secp224r1, 21us;
    Secp256k1, 22us;
    Secp256r1, 23us;
    Secp384r1, 24us;
    Secp521r1, 25us;
    X25519, 29us;
    X448, 30us;
    Ffdhe2048, 256us;
    Ffdhe3072, 257us;
    Ffdhe4096, 258us;
    Ffdhe6144, 259us;
    Ffdhe8192, 260us;
  ] in
  [@inline_let] let _ =
    assert_norm (L.noRepeats (LP.list_map fst e))
  in
  [@inline_let] let _ = 
    assert_norm (L.noRepeats (LP.list_map snd e))
  in e

noextract let namedGroup_repr_parser = LPI.parse_u16

noextract let namedGroup_repr_serializer = LPI.serialize_u16

inline_for_extraction noextract let namedGroup_repr_parser32 = LS.parse32_u16

inline_for_extraction noextract let namedGroup_repr_serializer32 = LS.serialize32_u16

inline_for_extraction noextract let namedGroup_repr_size32 = LSZ.size32_u16

inline_for_extraction noextract let namedGroup_repr_validator = (LL.validate_u16 ())

inline_for_extraction noextract let namedGroup_repr_jumper = LL.jump_u16

inline_for_extraction noextract let namedGroup_repr_reader = LL.read_u16

inline_for_extraction noextract let namedGroup_repr_writer = LL.write_u16

inline_for_extraction let synth_namedGroup (x:LP.maybe_enum_key namedGroup_enum) : namedGroup = 
  match x with
  | LP.Known k -> k
  | LP.Unknown y ->
    [@inline_let] let v : U16.t = y in
    [@inline_let] let _ = assert_norm (LP.list_mem v (LP.list_map snd namedGroup_enum) == known_namedGroup_repr v) in
    Unknown_namedGroup v

inline_for_extraction let synth_namedGroup_inv (x:namedGroup) : LP.maybe_enum_key namedGroup_enum = 
  match x with
  | Unknown_namedGroup y ->
    [@inline_let] let v : U16.t = y in
    [@inline_let] let _ = assert_norm (LP.list_mem v (LP.list_map snd namedGroup_enum) == known_namedGroup_repr v) in
    LP.Unknown v
  | x ->
    [@inline_let] let x1 : namedGroup = x in
    [@inline_let] let _ : squash(not (Unknown_namedGroup? x1) ==> LP.list_mem x1 (LP.list_map fst namedGroup_enum)) =
      _ by (LP.synth_maybe_enum_key_inv_unknown_tac x1)
    in
    LP.Known (x1 <: LP.enum_key namedGroup_enum)

let lemma_synth_namedGroup_inv' () : Lemma
  (LP.synth_inverse synth_namedGroup_inv synth_namedGroup)
= LP.forall_maybe_enum_key namedGroup_enum (fun x -> synth_namedGroup_inv (synth_namedGroup x) == x)
    (_ by (LP.forall_maybe_enum_key_known_tac ()))
    (_ by (LP.forall_maybe_enum_key_unknown_tac ()))

let lemma_synth_namedGroup_inj () : Lemma
  (LP.synth_injective synth_namedGroup) = 
  lemma_synth_namedGroup_inv' ();
  LP.synth_inverse_synth_injective synth_namedGroup synth_namedGroup_inv

#push-options "--max_ifuel 0 --initial_ifuel 0 --max_fuel 0 --max_ifuel 0"
let lemma_synth_namedGroup_inv () : Lemma
  (LP.synth_inverse synth_namedGroup synth_namedGroup_inv) = allow_inversion namedGroup; ()

#pop-options
noextract let parse_maybe_namedGroup_key : LP.parser _ (LP.maybe_enum_key namedGroup_enum) =
  LP.parse_maybe_enum_key namedGroup_repr_parser namedGroup_enum

noextract let serialize_maybe_namedGroup_key : LP.serializer parse_maybe_namedGroup_key =
  LP.serialize_maybe_enum_key namedGroup_repr_parser namedGroup_repr_serializer namedGroup_enum

noextract let namedGroup_parser : LP.parser _ namedGroup =
  lemma_synth_namedGroup_inj ();
  parse_maybe_namedGroup_key `LP.parse_synth` synth_namedGroup

noextract let namedGroup_serializer : LP.serializer namedGroup_parser =
  lemma_synth_namedGroup_inj ();
  lemma_synth_namedGroup_inv ();
  LP.serialize_synth _ synth_namedGroup serialize_maybe_namedGroup_key synth_namedGroup_inv ()
val namedGroup_bytesize (x:namedGroup) : GTot nat
x: Parsers.NamedGroup.namedGroup -> Prims.GTot Prims.nat