/** * @fileoverview Referential Identity Invariant (I2) * * I2: Entity refs within graph maintain identity. * * Per SPEC Section 8.2: * INVARIANT: For all entity references r1, r2 in graph G: * - If r1 and r2 refer to the same entity, they share a symbolic identity * - Identity is preserved across node boundaries * * This module provides STRUCTURAL referential identity checking. * - Checks that all dependsOn references point to existing nodes * - Checks symbolic reference consistency (same ref kind used consistently) * * Lexicon-based entity type checking is in validate/lexicon.ts. */ import type { IntentGraph, IntentNodeId } from "../core/types/intent-graph.js"; /** * Result of referential identity check. */ export type ReferentialIdentityCheckResult = { readonly valid: true; } | { readonly valid: false; readonly error: "BROKEN_EDGE" | "SELF_DEPENDENCY"; readonly nodeId: IntentNodeId; readonly details: string; }; /** * Check the I2 (Referential Identity) invariant - STRUCTURAL check. * * This checks: * 1. All dependsOn references point to existing nodes * 2. No self-references (node depending on itself) * * Note: Entity type consistency checking requires Lexicon * and is done in validate/lexicon.ts. * * @param graph - The Intent Graph to check * @returns Result with validity and optional error details */ export declare function checkReferentialIdentity(graph: IntentGraph): ReferentialIdentityCheckResult; /** * Check if graph passes referential identity check. * * Convenience wrapper that returns a boolean. */ export declare function isReferentialIdentityValid(graph: IntentGraph): boolean; /** * Entity type conflict information. */ export type EntityTypeConflict = { readonly entityId: string; readonly firstType: string; readonly firstNode: IntentNodeId; readonly secondType: string; readonly secondNode: IntentNodeId; }; /** * Result of entity type consistency check. */ export type EntityTypeConsistencyResult = { readonly valid: boolean; readonly conflicts: readonly EntityTypeConflict[]; }; /** * Check entity type consistency (I2-S invariant). * * Per SPEC Invariant I2-S: * Same entity ID MUST have the same entityType across all nodes. * * @param graph - The Intent Graph to check * @returns Result with validity and any conflicts found */ export declare function checkEntityTypeConsistency(graph: IntentGraph): EntityTypeConsistencyResult; //# sourceMappingURL=referential-identity.d.ts.map