Raw Packages #
This file defines raw packages - collections of typed function implementations. A raw package maps operation identifiers to their implementations.
Main definitions #
TypedFun- A typed function implementation (input type, output type, implementation)RawPackage- A collection of typed function implementationsRawPackage.link- Sequential composition (linking) — shallow-layer no-op stub (returns its first argument unchanged, becauseRawPackagestores oracle-free typed functions with nothing to substitute). Real oracle-substituting linking lives in the deep embedding:CatCrypt.Deep.Package.link, proven correct and associative byrunPkg_link/runPkg_link_associnNomAdvantage.RawPackage.par- Parallel compositionRawPackage.id- Identity package
References #
A typed function: source type, target type, and implementation
- src : Type
Input type
- tgt : Type
Output type
- impl : self.src → Core.SPComp self.tgt
Implementation: src → SPComp tgt
Instances For
DecidableEq for TypedFun
Package entry: operation id with its typed implementation
Instances For
DecidableEq for PackageEntry (needed for Finset operations)
Raw package: a finite collection of typed function implementations. Each entry maps an operation id to its implementation.
- entries : Finset PackageEntry
Instances For
Empty package
Equations
- CatCrypt.Package.RawPackage.empty = { entries := ∅, unique_ids := CatCrypt.Package.RawPackage.empty._proof_1 }
Instances For
Equations
- CatCrypt.Package.RawPackage.instEmptyCollection = { emptyCollection := CatCrypt.Package.RawPackage.empty }
The set of operation ids implemented by the package
Equations
- P.ids = Finset.image (fun (x : CatCrypt.Package.PackageEntry) => x.id) P.entries
Instances For
Lookup an implementation by id (noncomputable)
Equations
Instances For
Single function package
Equations
Instances For
Two packages are disjoint if they share no operation ids
Instances For
Parallel composition: combine two packages with disjoint ids
Instances For
Resolve: find the implementation for an operation id and call it.
Returns fail if the operation is not implemented.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Sequential composition (linking): P₁ imports from P₂.
WARNING: This is a stub that returns P₁ unchanged.
The shallow RawPackage representation stores typed functions
(S → SPComp T) that have no notion of oracle calls, so there
is nothing to substitute. This makes link a no-op.
For real package linking, use the deep embedding layer:
DeepPackage.linkinCatCrypt.Deep.Packageperforms actual oracle substitution viaRawCode.substOraclerunPkg_linkinCatCrypt.Crypto.NomAdvantageproves correctnessrunPkg_link_assocproves associativity at the evaluation level
Instances For
Identity package: implements an interface by just forwarding