Documentation

Cryptlib.Primitives.KEM.KEM

Instances For
    Instances For
      @[instance_reducible]
      Equations
      • One or more equations did not get rendered due to their size.
      @[instance_reducible]
      Equations
      @[reducible, inline]
      abbrev Cryptlib.Primitives.KEM.KEM.KEMM (kemSpec : KEM) (α : Type) :
      Equations
      Instances For
        @[reducible, inline]
        Equations
        Instances For
          @[reducible, inline]
          Equations
          Instances For
            @[reducible, inline]
            Equations
            Instances For
              @[reducible, inline]
              Equations
              Instances For
                def Cryptlib.Primitives.KEM.KEM.generate (kemSpec : KEM) :
                KEMM kemSpec (PublicKey kemSpec × PrivateKey kemSpec)
                Equations
                Instances For
                  def Cryptlib.Primitives.KEM.KEM.encap (kemSpec : KEM) :
                  PublicKey kemSpec → KEMM kemSpec (Ciphertext kemSpec × Plaintext kemSpec)
                  Equations
                  Instances For
                    def Cryptlib.Primitives.KEM.KEM.decap (kemSpec : KEM) :
                    PrivateKey kemSpec → Ciphertext kemSpec → KEMM kemSpec (Plaintext kemSpec)
                    Equations
                    Instances For
                      def Cryptlib.Primitives.KEM.KEM.IsEncapsulation (kemSpec : KEM) (sk : PrivateKey kemSpec) (c : Ciphertext kemSpec) (k : Plaintext kemSpec) :
                      Equations
                      Instances For
                        def Cryptlib.Primitives.KEM.KEM.KeyPair (kemSpec : KEM) (pk : PublicKey kemSpec) (sk : PrivateKey kemSpec) :
                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          theorem Cryptlib.Primitives.KEM.KEM.EStateM_triple_ok {ε σ α : Type u_1} {p : α → Prop} {x : EStateM ε σ α} (h : ∀ (t : σ) (a : α) (t' : σ), x t = EStateM.Result.ok a t' → p a) :
                          ⦃⌜True⌝⦄ x ⦃(fun (a : α) => ⌜p a⌝, fun (x : ε) => ⌜True⌝, PUnit.unit)⦄

                          Partial-correctness triple: if x returns, its result satisfies p.

                          theorem Cryptlib.Primitives.KEM.KEM.EStateM_triple {ε σ α : Type u_1} {p : α → Prop} {x : EStateM ε σ α} (h : ∀ (t : σ), ∃ (a : α), ∃ (t' : σ), x t = EStateM.Result.ok a t' ∧ p a) :
                          ⦃⌜True⌝⦄ x ⦃(fun (a : α) => ⌜p a⌝, fun (x : ε) => ⌜False⌝, PUnit.unit)⦄

                          Total-correctness triple: x always returns a result satisfying p.

                          theorem Cryptlib.Primitives.KEM.KEM.generate_keyPair (kemSpec : KEM) {t : kemSpec.State} {r : PublicKey kemSpec × PrivateKey kemSpec} {t' : kemSpec.State} (hr : generate kemSpec t = EStateM.Result.ok r t') :
                          KeyPair kemSpec r.fst r.snd

                          Whatever generate returns is a valid key pair.

                          theorem Cryptlib.Primitives.KEM.KEM.generate_ok (kemSpec : KEM) :
                          ⦃⌜True⌝⦄ generate kemSpec ⦃(fun (x : PublicKey kemSpec × PrivateKey kemSpec) => match x with | (pk, sk) => ⌜KeyPair kemSpec pk sk⌝, fun (x : KEMError) => ⌜True⌝, PUnit.unit)⦄
                          theorem Cryptlib.Primitives.KEM.KEM.encap_ok (kemSpec : KEM) {pk : PublicKey kemSpec} {sk : PrivateKey kemSpec} (h : KeyPair kemSpec pk sk) (t : kemSpec.State) (hrel : kemSpec.Reliable t) (r : Ciphertext kemSpec × Plaintext kemSpec) (t' : kemSpec.State) :
                          encap kemSpec pk t = EStateM.Result.ok r t' → IsEncapsulation kemSpec sk r.fst r.snd

                          Encapsulation from a Reliable state to a valid key pair decapsulates correctly. Stated as a plain proposition because the precondition constrains the starting state.

                          theorem Cryptlib.Primitives.KEM.KEM.decap_ok (kemSpec : KEM) {sk : PrivateKey kemSpec} {ct : Ciphertext kemSpec} {k : Plaintext kemSpec} (h : IsEncapsulation kemSpec sk ct k) :
                          ⦃⌜True⌝⦄ decap kemSpec sk ct ⦃(fun (k' : Plaintext kemSpec) => ⌜k' = k⌝, fun (x : KEMError) => ⌜False⌝, PUnit.unit)⦄