The P-Completeness of Inverted Index Traversal: On the Complexity of Evaluating Boolean Query DAGs

| Source: Apple ML Research

Tags: Apple, inverted-index, boolean-query, P-Complete, information-retrieval, agentic-AI, ComputePN

Apple researchers prove that evaluating boolean query DAGs over inverted indices is P-Complete, then introduce ComputePN — an algorithm that bounds evaluation to O(|Q| · |U_active|) time by decoupling logical negation from universe-wide scans, directly relevant to AI agent search pipelines.

Details

Modern AI agents relying on search for neuro-symbolic reasoning often need deeply nested boolean queries over text indexes. This Apple ML Research paper formally characterizes the theoretical limits of that problem. Standard approaches hit walls in both directions: Document-at-a-Time iterators face an exponential O(2^|Q|) blowup when queries re-converge, while Term-at-a-Time materialization requires scanning the entire document universe to handle logical negation. The paper formalizes a retrieval language (L_R) based on Directed Acyclic Graphs and proves its evaluation is strictly P-Complete — unlikely to be parallelized in the NC sense. To make evaluation tractable, the authors introduce ComputePN, which decouples negation from the full universe scan via a Positive-Negative dual representation and leverages native DAG memoization. The result: O(|Q| · |U_active|) evaluation time, bounded by the query and active document set rather than the full corpus. For teams building AI agents with search infrastructure, this work provides formal grounding for why standard inverted index approaches break under complex boolean logic — and a concrete algorithmic solution. The paper is authored by Amir Aavani and explicitly frames the problem in the context of agentic neuro-symbolic workflows.