/** * ProofCompositionLaw — algebraic receipt composition (Paper 29, H2). * * Composes N `WrappedSolverResult` receipts into a `ComposedReceipt` that * proves the conjunction of all constituent solver contracts. Five laws * govern the composition; `verifyCompositionLaws` checks any receipt * against all five. * * ## The five laws * * | Law | Name | Rule | * |-----|------|------| * | 1 | empty-identity | compose([]) → composedVerified:true, composedSchemaValid:null | * | 2 | and-monotone | composedVerified = ∀c: c.contractVerified | * | 3 | schema-null-coalescing-and | composedSchemaValid = null if all null; else ∀ non-null: true | * | 4 | violation-union | allViolations = ⋃ c.clauseViolations | * | 5 | flat-associativity | compose(compose(A,B).components, C) ≡ compose(A,B,C) | * * Law 5 is enforced by keeping composition flat — `flattenForRecompose` exposes * the primitive that makes it structurally verifiable. * * ## Domain-neutrality * * No domain nouns appear here. This module only composes proof shapes; * domain-specific solvers register their own contracts and schemas. */ import type { WrappedSolverResult, PluginClauseViolation, SchemaViolation } from '../plugin-solver-contract/PluginSolverContract'; export declare const PROOF_COMPOSITION_LAWS: readonly ["empty-identity", "and-monotone", "schema-null-coalescing-and", "violation-union", "flat-associativity"]; export type ProofCompositionLaw = (typeof PROOF_COMPOSITION_LAWS)[number]; /** * The algebraic receipt produced by `composeReceipts`. * * Carries the conjunction of all constituent solver contracts' verification * state, the union of all violations, provenance, and a stable identity hash. */ export interface ComposedReceipt { /** Constituent wrapped solver results (in input order). */ readonly components: ReadonlyArray>; /** * True iff every component has `contractVerified: true` (Laws 1 + 2). * Empty composition yields `true`. */ readonly composedVerified: boolean; /** * Schema validation verdict over all components (Law 3): * - `null` → all components are freeform (no schema registered for any). * - `true` → at least one component has a schema; all non-null pass. * - `false` → at least one component has a schema and it failed. */ readonly composedSchemaValid: boolean | null; /** Union of all clause violations across components (Law 4). */ readonly allViolations: ReadonlyArray; /** Union of all schema violations across components. */ readonly allSchemaViolations: ReadonlyArray; /** Deduplicated plugin ids contributing to this composition. */ readonly pluginIds: ReadonlyArray; /** Deduplicated contract ids contributing to this composition. */ readonly contractIds: ReadonlyArray; /** * FNV-1a 32 hash of the composition's verification state (prefix `"fnv1a32:<8 hex>"`). * Identical components with identical verification state → identical hash. * Non-cryptographic — use `'secure'` hash-policy for on-chain anchoring. */ readonly hash: string; } /** * Compose N `WrappedSolverResult` receipts into one `ComposedReceipt`. * * All five composition laws are enforced by construction. Pass the result * of `wrapSolverInContract` calls from multiple plugins to prove the * conjunction of their solver contracts in a single receipt. */ export declare function composeReceipts(components: ReadonlyArray>): ComposedReceipt; /** * Flatten a `ComposedReceipt`'s components for re-composition with additional receipts. * * Structural proof of Law 5 (flat-associativity): * `composeReceipts(flattenForRecompose(ab, [c]))` * is verification-equivalent to * `composeReceipts([...ab.components, c])`. */ export declare function flattenForRecompose(composed: ComposedReceipt, additional?: ReadonlyArray>): ReadonlyArray>; /** * Verify that a `ComposedReceipt` satisfies all five composition laws. * * Returns the names of violated laws. An empty array means the receipt * is fully law-compliant. Useful in tests and receipt audit flows. * * Note: Law 1 (empty-identity) and Law 5 (flat-associativity) are enforced * structurally by `composeReceipts`; only Laws 2–4 are checkable on an * arbitrary receipt. */ export declare function verifyCompositionLaws(receipt: ComposedReceipt): ProofCompositionLaw[];