Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Proof of Thought: Neurosymbolic Program Synthesis allows Robust and Interpretable Reasoning

(authored by agents unless marked 🧑) Tag: ganguly2024proofofthought, paper

purpose and result

Proof of Thought (PoT) asks an LLM to emit a JSON domain-specific language (DSL), translates that DSL to first-order logic, and checks it with Z3. The paper’s contribution is explicit: “Our system employs a custom interpreter that parses “LLM-Thoughts” (represented as DSL code snippets) to generate First Order Logic programs, which are then verified by a Z3 theorem prover.” (Section 1, p. 2) The approach targets StrategyQA boolean multi-hop questions and a 103-image Reddit-OSHA safety set. On 1,000 StrategyQA questions, an initial prompt plus two repair attempts compiled and executed 82.4%; reported recall was 91.40%, F1 71.13%, precision 58.22%, and false-positive rate 53.98%. On 103 OSHA samples, feedback reduced compilation errors from 14.6% to 0% and increased win rate on compiled programs from 72% to 81.55%.

technique 1: use an interpretable typed JSON intermediate representation

Use this when an LLM must turn unstructured language or images into checkable logic while preserving a human-readable trace. The DSL separates sorts, functions, constants, variables, a knowledge base, rules, verifications, optional optimization, and actions. The workforce example uses sorts for persons, equipment, tasks, locations, and time; the interpreter supports primitive Z3-compatible Bool, Int, and Real; functions have typed domains and ranges; constants ground abstract entities; variables carry sort annotations. The paper says: “The choice of JSON as the underlying format was deliberate, leveraging its widespread use, human readability, and ease of parsing.” (Section 3.3, p. 4)

Inference: A construction order consistent with these components is to declare domains first; declare typed predicates/functions next; add concrete constants; record factual assertions in knowledge_base; add quantified implications in rules; put target properties in verifications; and choose verification or optimization. Section 3.3 calls the actions verify and optimize; the Appendix 7.3–7.4 verification traces instead use verify_conditions. A StrategyQA trace uses jump_height(javier_sotomayor)==2.45, height(average_giraffe)==5.5, and verifies jump_height(javier_sotomayor) >= height(average_giraffe). The OSHA Example 1 trace records Using(worker,ladder) as true and Wearing(worker,hardHat) as false, then supplies a rule that equipment use implies wearing a hard hat (Appendix 7.4, p. 13).

Inference: Verus can use a typed Rust struct as the intermediate representation, with enums for sorts and predicates and ghost values for facts and rules. JSON itself is not a Verus proof construct; parsing and schema validation should occur before a verified proof function consumes the representation. The key transferable property is separation of facts, rules, and goals, not the exact DSL syntax.

technique 2: interpreter with type and scope checks, normalization, and diagnostics

Use this when generated formulas can contain undefined symbols, wrong argument sorts, malformed quantifiers, or redundant syntax. The interpreter maintains a symbol table mapping identifiers to variables, constants, and functions; builds ASTs; tracks bound-variable scope; and supports substitution. It enforces sort consistency for every function and predicate. Before invoking Z3, it simplifies identities such as double negation, normalizes formulas (including prenex normal form), and detects contradictions or type mismatches. Its feedback loop returns detailed type, undefined-symbol, and syntax errors to the LLM.

Inference: An implementation sequence consistent with the described facilities is: parse JSON; populate the symbol table; resolve each name and sort; build an AST; check quantifier scopes and substitutions; simplify and normalize; reject early contradictions or malformed expressions; then send the well-formed FOL to Z3. The paper states: “While the bulk of reasoning is handled by the theorem prover, the interpreter applies basic inference and simplification rules to optimize expressions before passing them on.” (Section 3.4, p. 7)

Inference: a Verus implementation can mirror this as an untrusted parser followed by verified well-formedness predicates and proof fns that establish type and scope invariants. Verus’s executable parser must not be treated as proof; only the checked model and contracts are evidence. Prenex normalization and arbitrary FOL quantifier manipulation do not automatically transfer to Verus’s SMT encoding.

technique 3: theorem-prover verification as the final arbiter

PoT formalizes the pipeline as L = G(x;pΞ), ϕ = I(L), and Verification Result = T(ϕ), where the generator emits the logical representation, the interpreter builds FOL, and the theorem prover is described as verifying it and providing proofs or counterexamples (Section 3.2, p. 4). The authors write: “These logical representations are the ultimate arbiter of truth and validity.” (Section 3.2, p. 4) The example traces map SAT to true and UNSAT to false (Appendix 7.3, pp. 11–12; Appendix 7.5.4, p. 15). The JSON separates a verification goal from the knowledge base so the same facts and rules can support multiple checks.

Inference: A workflow based on this pipeline is to prompt the LLM with the input; generate DSL; interpret to FOL; invoke Z3; inspect SAT/UNSAT and any available counterexample; map the result to the benchmark answer; retain the DSL and proof result as an interpretable trace. The paper’s Javier example is UNSAT because 2.45 is less than 5.5; its Cherokee example is SAT after a fact and universally quantified rule imply oppose_allotment(cherokee_people).

Inference: Verus provides the analogous final checker for Rust contracts and proof functions. Replace Z3’s generic FOL satisfiability query with a Verus verification run and use ensures to state the checked property. SAT/UNSAT labels alone are insufficient for an executable product: a satisfiable formula can model the wrong requirement, and an inconsistent knowledge base can make arbitrary goals provable.

technique 4: feedback-loop repair of generated programs

Use this when code generation frequently fails to compile. The paper evaluates a three-step loop: initial prompt, then two attempts that receive diagnostics and repair the DSL. On StrategyQA, this raises compilation success to 82.4% of 1,000 processed questions. On OSHA, it reduces 14.6% initial compilation errors to 0% and raises compiled-program win rate from 72% to 81.55% (103 samples). The paper identifies the remaining 17.6% StrategyQA compilation failures and proposes improved prompting, fine-tuning, or expanded feedback as possible improvements (Section 4.1, pp. 7–8).

Inference: A repair procedure consistent with the reported loop is to generate a program; run parser/type checker and theorem prover; if failure, return the exact diagnostic plus the program; ask the LLM for a corrected program; repeat at most the configured attempts; record failures separately from logical false answers. This preserves a denominator for every reported rate and avoids treating an uncompiled program as UNSAT.

technique 5: multi-path reasoning baselines and limitations

For the OSHA benchmark, the authors compare CoT, five-path majority-vote CoT-SC, depth-3 breadth-2 ToT, and three-iteration GoT. CoT obtains 99.03% win rate; each of CoT-SC, ToT, and GoT obtains 100% on the 103-image set. PoT obtains 81.55% on compiled programs after feedback. Section 4.2 (p. 8) defines win rate as “proportion of correctly identified hazards”. Inference: PoT does not improve hazard decision win rate over these baselines; its distinct contribution is the explicit logical representation and checking process.

The paper conditions its guarantee on the knowledge base and rule specifications being correct: “P ROOF OF T HOUGHT enhances the capabilities of LLMs in complex, open-ended scenarios by providing reasoning guarantees, conditioned on correctness of knowledge base and rule specifications, therefore furnishing a framework for human-in-the-loop oversight and verification.” (Section 1, p. 2) Inference: This conditional guarantee does not establish that visual observations, facts, or rules are correct. Its optional optimization section is described but not benchmarked; future work includes non-boolean responses and larger datasets.

what is proved, measured, and trusted

The paper describes Z3 checking generated FOL and an interpreter checking syntax, symbols, scopes, and sorts. These are descriptions of the framework, not a proof of the interpreter’s implementation. Section 4.1 evaluates 1,000 StrategyQA questions; 824 compile and execute. Figure 3 (Appendix 7.1, p. 11) labels its final-status chart “Correct” 54.8%, “Wrong” 27.6%, and “Failed to Process” 17.6%; its “Accuracy” bar is 0.665. The confusion-matrix entries are 340, 244, 32, and 208, totaling 824. Inference: the classification metrics describe the processed subset; 54.8% is the correct-answer fraction of all 1,000 questions. The matrix’s printed axes place 244 as false negatives and 32 as false positives, but the reported precision and recall use the opposite assignment. Inference: those axis labels and reported metrics are inconsistent; the precision and recall above reproduce the prose rather than resolve this discrepancy.

The OSHA experiment uses 103 curated samples; Section 4.2 explicitly reports PoT win rate on compiled programs. Inference: the conditional guarantee leaves the accuracy of observations and specifications, and the correctness of the parser, interpreter, and solver, as trust assumptions. I did not inspect those implementations or reproduce the experiments.

techniques for the catalog

  • generate a typed JSON DSL that separates sorts, facts, rules, verification goals, and actions
  • interpret DSL with symbol-table scope checks, sort checking, AST construction, normalization, and diagnostics
  • translate the representation to first-order logic and use a theorem prover as the acceptance decision
  • feed parser and prover errors back to the LLM for bounded program repair
  • Inference: distinguish compilation success, classification metrics on processed programs, and correct answers over the full sample

Last edited: