The Holographic Reasoning Engine leverages Hyperdimensional Computing (HDC) as the primary mechanism for finding candidate proofs and query answers. It uses vector similarity to rapidly identify likely solutions, then validates them with symbolic proof for correctness.
The holographic engine prioritizes:
HolographicProofEngine follows this pipeline:
| Step | Operation | Description |
|---|---|---|
| 1 | Build Goal Vector | Encode goal as HDC vector using positional binding |
| 2 | Check Negation | Verify goal isn't explicitly negated in KB |
| 3 | HDC Direct Search | Scan KB for similar vectors (threshold: HDC_MATCH) |
| 3b | Synonym Matching | Try ComponentKB synonym expansion if no direct match |
| 4 | Symbolic Validation | Verify HDC candidate with ProofEngine |
| 5 | HDC Transitive Search | BFS through HDC-similar edges for transitive relations |
| 6 | HDC Rule Search | Match rule conclusions via similarity, check conditions |
| 7 | Symbolic Fallback | If HDC fails, run full symbolic proof search |
Drop-in replacement for ProofEngine. Same interface, different strategy.
import { HolographicProofEngine } from './reasoning/holographic/prove-hdc-first.mjs';
const engine = new HolographicProofEngine(session, {
maxDepth: 10,
timeout: 5000
});
// Prove using HDC-first approach
const result = engine.prove({
type: 'Statement',
operator: { name: 'isA' },
args: [{ name: 'Tweety' }, { name: 'Animal' }]
});
// Result includes method information
console.log(result);
// {
// valid: true,
// confidence: 0.91,
// method: 'hdc_transitive_validated', // HDC found it, symbolic validated
// steps: [...],
// reasoningSteps: 3
// }
| Method | Description |
|---|---|
prove(goal) |
Main entry. HDC search first, symbolic validation, then fallback. |
hdcDirectSearch(vec, str) |
Scan KB bundle for similar vectors. Returns candidates. |
hdcTransitiveSearch(goal, vec) |
BFS through HDC edges for transitive chains. |
hdcRuleSearch(goal, vec) |
Match rule conclusions via similarity, verify conditions. |
validateWithSymbolic(goal) |
Confirm HDC candidate with full symbolic proof. |
HDC-first query resolution using the unbind operation.
import { HolographicQueryEngine } from './reasoning/holographic/query-hdc-first.mjs';
const engine = new HolographicQueryEngine(session);
// Query: "What can Tweety do?" (can Tweety ?action)
const result = engine.execute({
type: 'Statement',
operator: { name: 'can' },
args: [
{ name: 'Tweety', type: 'Identifier' },
{ name: 'action', type: 'Hole' }
]
});
// HDC unbind finds candidates, symbolic validates
console.log(result);
// {
// success: true,
// bindings: Map { 'action' => { answer: 'Fly', similarity: 0.94, method: 'hdc_validated' } },
// confidence: 0.94,
// allResults: [...]
// }
Answer = KB BIND QueryPartial⁻¹ BIND Position⁻¹Constraint Satisfaction with HDC-guided heuristics.
import { HolographicCSPSolver } from './reasoning/holographic/csp-hdc-heuristic.mjs';
const solver = new HolographicCSPSolver(session, {
hdcWeight: 0.7, // Weight for HDC heuristic
maxSolutions: 100
});
// Same interface as CSPSolver
solver.addVariable('Alice', ['Table1', 'Table2', 'Table3']);
solver.addVariable('Bob', ['Table1', 'Table2', 'Table3']);
solver.addNoConflict('Alice', 'Bob');
const result = solver.solve();
// HDC guides domain ordering for faster search
Build HDC vectors representing valid assignment states. Bundle all valid configurations.
// Valid state: Alice at T1, Bob at T2
const state = bind(
bind(AliceVec, Table1Vec),
bind(BobVec, Table2Vec)
);
csBundle = bundle([...validStates]);
Order domain values by HDC similarity to constraint satisfaction bundle.
// Score hypothetical assignment
const score = scoreCandidate(
session,
hypotheticalAssignment,
csBundle
);
// Higher similarity = try first
Skip candidates with low similarity to valid states.
// In backtracking search
if (score < VERIFICATION_THRESHOLD) {
stats.hdcPruned++;
continue; // Skip this branch
}
The holographic query equation leverages HDC's algebraic properties:
Result vector is similar to the missing component(s).
// For query: "isA Tweety ?what"
// Query vector encodes: operator=isA, pos1=Tweety, pos2=?
const queryPartial = bind(
isAVec,
bind(Pos1Vec, TweetyVec)
);
// Unbind from KB to get what's at position 2
const answerVec = unbind(
unbind(kbBundle, queryPartial),
Pos2Vec
);
// Find most similar in vocabulary
const candidates = topKSimilar(answerVec, vocabulary, 10);
// → [{ name: 'Bird', similarity: 0.94 }, ...]
The holographic engine integrates with ComponentKB for semantic matching:
// KB contains: isA Rex Dog
// Query: isA Rex Canine
// ComponentKB knows: Dog synonymOf Canine
const result = engine.prove(parseGoal("isA Rex Canine"));
// {
// valid: true,
// confidence: 0.95,
// method: 'synonym_match',
// matchedFact: 'isA Rex Dog',
// steps: [{ operation: 'synonym_match', synonymUsed: 'Canine <-> Dog' }]
// }
HDC thresholds are strategy-dependent (dense-binary vs sparse-polynomial vs metric-affine/EMA vs EXACT):
// From constants.mjs - holographic-specific thresholds
const holographicThresholds = {
// Query unbind
UNBIND_MIN_SIMILARITY: 0.3, // Minimum to consider as candidate
UNBIND_MAX_CANDIDATES: 15, // Top-K limit
// Proof search
HDC_MATCH: 0.85, // Direct KB match threshold
CONCLUSION_MATCH: 0.7, // Rule conclusion similarity
VERIFICATION: 0.6, // Symbolic validation threshold
// Behavior flags
FALLBACK_TO_SYMBOLIC: true, // Allow symbolic fallback
VALIDATION_REQUIRED: true // Require symbolic validation
};
Some concrete implications:
Additional stats specific to holographic mode:
session.reasoningStats = {
// HDC queries
holographicQueries: 0,
hdcUnbindAttempts: 0,
hdcUnbindSuccesses: 0,
// HDC proofs
holographicProofs: 0,
hdcProofSuccesses: 0,
// Validation
hdcValidationAttempts: 0,
hdcValidationSuccesses: 0,
// Fallbacks
symbolicProofFallbacks: 0,
// CSP
holographicCSP: 0,
cspBundleBuilt: 0,
cspSymbolicFallback: 0
};
HDC-guided BFS for transitive relations:
// Finding: isA Tweety Animal
// KB: isA Tweety Bird, isA Bird Animal
// 1. Start at Tweety, find HDC-similar "isA Tweety ?" edges
const edges = findHDCEdges('isA', 'Tweety');
// → [{ to: 'Bird', similarity: 0.96 }]
// 2. BFS continues from Bird
const edges2 = findHDCEdges('isA', 'Bird');
// → [{ to: 'Animal', similarity: 0.95 }]
// 3. Found target! Build chain
const chain = [
{ from: 'Tweety', to: 'Bird', similarity: 0.96 },
{ from: 'Bird', to: 'Animal', similarity: 0.95 }
];
// 4. Validate each step symbolically
for (const step of chain) {
if (!symbolicEngine.prove(`isA ${step.from} ${step.to}`).valid) {
return { valid: false };
}
}
// 5. Return validated chain proof
return {
valid: true,
confidence: computeChainConfidence(chain.length),
method: 'hdc_transitive_validated',
steps: chain.map(...)
};
| Aspect | Symbolic | Holographic |
|---|---|---|
| Primary mechanism | Rule/pattern matching | Vector similarity |
| Search strategy | Priority-ordered strategies | HDC candidates + validation |
| KB access pattern | Targeted lookups | Bundle similarity scan |
| False positive risk | None (exact match) | Mitigated by validation |
| Fuzzy matching | Limited (synonyms only) | Native (similarity) |
| CSP heuristics | Standard backtracking | HDC-guided ordering |
| Best for | Strict correctness | Large/noisy KBs |
HDC bundle operations scale sub-linearly. Finding candidates in 100K facts is nearly as fast as 1K facts.
Similarity-based search finds relevant facts even with spelling variations or incomplete information.
Native support for "find things similar to X" without explicit rules.
HDC heuristics can dramatically reduce search space in constraint satisfaction.
// Query: prove "can Tweety Fly"
// KB: isA Tweety Bird, can Bird Fly
const result = engine.prove(parseGoal("can Tweety Fly"));
// Trace:
// 1. Build goal vector: bind(canVec, bind(Pos1, TweetyVec), bind(Pos2, FlyVec))
// 2. HDC direct search: best similarity = 0.72 (below threshold)
// 3. Synonym check: no synonyms for 'can'
// 4. HDC rule search:
// - Found rule: "If isA ?x Bird Then can ?x Fly"
// - Conclusion similarity: 0.89
// - Check condition "isA Tweety Bird": HDC finds it (0.96)
// - Validate condition symbolically: ✓
// 5. Validate rule application symbolically: ✓
// Result:
{
valid: true,
confidence: 0.85,
method: 'hdc_rule_validated',
goal: 'can Tweety Fly',
rule: 'BirdCanFly',
steps: [
{
operation: 'rule_application',
rule: 'BirdCanFly',
confidence: 0.85
}
],
reasoningSteps: 4
}