Documentation

VCVio.SSP.Composition

State-Separating Proofs: Composition #

This file defines the two basic composition operators on Packages and proves the program-level reduction lemmas relating their simulateQ and run to nested calls.

These correspond to SSProve's link and par. Disjointness of the two state factors is structural: each side's handler can only modify its own factor, so non-interference is a type-level fact rather than a separation predicate that needs to be proved.

Universe layout #

All five "module" universes (the indices uᵢ, uₘ, uₑ and the import-range universe vᵢ) are independent. Both packages on either side of link must agree on the universe v of their export ranges and state, since link's product state lives in Type v. Likewise par requires the import ranges of p₁ and p₂ to share a universe (so + for OracleSpec typechecks), and similarly for the export ranges.

Parallel composition (par) #

The two summed specs in par must share the import range universe and the export range universe (otherwise the disjoint sums I₁ + I₂ and E₁ + E₂ cannot share a single OracleSpec type). To keep par mostly universe polymorphic, we additionally collapse the import and export range universes to the same v; this matches the typing pattern induced by liftComp from OracleComp Iᵢ into OracleComp (I₁ + I₂). The index universes remain independent.

def VCVio.SSP.Package.par {σ₁ σ₂ : Type v} {ιᵢ₁ ιᵢ₂ : Type uᵢ} {ιₑ₁ ιₑ₂ : Type uₑ} {I₁ : OracleSpec ιᵢ₁} {I₂ : OracleSpec ιᵢ₂} {E₁ : OracleSpec ιₑ₁} {E₂ : OracleSpec ιₑ₂} (p₁ : Package I₁ E₁ σ₁) (p₂ : Package I₂ E₂ σ₂) :
Package (I₁ + I₂) (E₁ + E₂) (σ₁ × σ₂)

Parallel composition of two packages.

Given p₁ exporting E₁ and importing I₁, and p₂ exporting E₂ and importing I₂, the parallel composite exports the disjoint sum E₁ + E₂ and imports the disjoint sum I₁ + I₂. Each side's handler is lifted along the obvious OracleComp Iᵢ ⊂ₒ OracleComp (I₁ + I₂) and the resulting state is the product σ₁ × σ₂.

State separation is automatic: each side's handler can only access its own state component, so modifications to the other side are behaviorally invisible. This is the structural-typing counterpart of SSProve's fseparate side-condition.

We do not use QueryImpl.prodStateT here because of awkward universe unification through OracleSpec sums; the body is the same up to the obvious lifts.

Instances For
    @[simp]
    theorem VCVio.SSP.Package.par_init {σ₁ σ₂ : Type v} {ιᵢ₁ ιᵢ₂ : Type uᵢ} {ιₑ₁ ιₑ₂ : Type uₑ} {I₁ : OracleSpec ιᵢ₁} {I₂ : OracleSpec ιᵢ₂} {E₁ : OracleSpec ιₑ₁} {E₂ : OracleSpec ιₑ₂} (p₁ : Package I₁ E₁ σ₁) (p₂ : Package I₂ E₂ σ₂) :
    (p₁.par p₂).init = (p₁.init, p₂.init)