Fermat Wormhole Path
SELECT path_theorems
FROM theorem_graph
WHERE src = 'fermat_domain_chain'
AND edge_type = 'FERMAT_WORMHOLE'
AND hops <= 4
ORDER BY hop_depth;
Cross-Domain Centrality
SELECT t.name,
COUNT(g.edge) as degree,
COUNT(DISTINCT g.domain) as domains
FROM theorems t
JOIN theorem_graph g ON t.id = g.source
WHERE g.edge_type = 'CROSS_DOMAIN_OF'
GROUP BY t.name
ORDER BY domains DESC LIMIT 10;
Semantic + Graph (Vector+SQL)
SELECT t.name, t.embed <=> $1 AS dist
FROM theorems t
JOIN theorem_graph g ON t.id = g.source
WHERE g.target = 'stale_watcher_crescent'
AND g.edge_type = 'INSTANCE_OF'
ORDER BY dist LIMIT 5;
-- $1 = embed('stale oracle exploit')
BHL Score Query
SELECT t.name, e.meta->>'bhl' AS bhl
FROM theorems t
JOIN theorem_graph e ON t.id = e.source
WHERE e.edge_type = 'BACKS_CLAIM'
AND e.target IN ('POC024','POC016','POC005')
ORDER BY (e.meta->>'bhl')::float DESC;