Documentation

CatCryptCore.Package.ValidPackage

Valid Packages #

This file defines valid packages - raw packages with proofs that they correctly implement their interface and only access declared locations.

Main definitions #

References #

Specification of location access in code. A full implementation would track this syntactically; this uses a semantic characterization.

  • reads : Locations

    Locations that may be read

  • writes : Locations

    Locations that may be written

Instances For
    class CatCrypt.Package.ValidCode (L : Locations) (I : Interface) (α : Type u_1) (c : Core.SPComp α) :

    Code validity: only accesses locations in L and imports from I. This is a predicate on computations asserting they respect the declared locations and import interface.

    Note: A full implementation would require tracking access syntactically or using a free monad representation. This uses a Prop-level assertion.

    The reads_in_L condition says the return-value distribution is unchanged when an out-of-scope location is overwritten — the code doesn't read it.

    Instances

      A valid package correctly implements an export interface using an import interface.

      • L: the locations the package may access
      • I: the interface the package may import
      • E: the interface the package exports
      Instances For

        Two packages have separate (disjoint) locations

        Equations
        Instances For
          theorem CatCrypt.Package.ValidPackage.validCode_weaken {L₁ L₂ : Locations} {I₁ I₂ : Interface} {α : Type u_1} {c : Core.SPComp α} (hL : L₁ L₂) (hv : ValidCode L₁ I₁ α c) :
          ValidCode L₂ I₂ α c

          Valid code for a smaller location set is valid for a larger one. This is mathematically sound: if code only accesses L₁, and L₁ ⊆ L₂, then the code trivially satisfies validity for L₂.

          Empty package is valid for empty interface

          theorem CatCrypt.Package.ValidPackage.par_valid {L₁ L₂ : Locations} {I₁ I₂ E₁ E₂ : Interface} {P₁ P₂ : RawPackage} (h₁ : ValidPackage L₁ I₁ E₁ P₁) (h₂ : ValidPackage L₂ I₂ E₂ P₂) (hL : L₁.Separate L₂) (hI : I₁.Disjoint I₂) (hP : P₁.Disjoint P₂) (hE : E₁.Disjoint E₂) :
          ValidPackage (L₁.union L₂ hL) (I₁.union I₂ hI) (E₁.union E₂ hE) (P₁.par P₂ hP)

          Parallel composition of valid packages

          Location tracking: get the locations from a ValidPackage

          Equations
          Instances For

            The game import interface (empty for basic games)

            Equations
            Instances For

              The adversary export interface (empty for basic adversaries)

              Equations
              Instances For