Large language models (LLMs) struggle with formal domains that require rigorous logical deduction and symbolic reasoning, such as mathematical proof generation. We propose a neuro-symbolic approach centered on the hypothesis that structurally analogous problems often admit similar proofs. As a proof-of-concept, we focus on SAT-level geometry problems. Our approach is two-fold: (1) We retrieve analogous problems and use their proofs to guide the LLM, and (2) a formal verifier evaluates the generated proofs and provides feedback, helping the model fix incorrect proofs. Our complete pipeline substantially improves proof accuracy across model families, achieving 68%-96% accuracy compared with 10%-44% for LLM-only baselines that use neither analogy retrieval nor verifier feedback. When comparing against models with the same verifier feedback and inference budget, analogical guidance improves accuracy from 88% to 96% for GPT-5, 78% to 86% for Claude Sonnet 4.6, 72% to 86% for Gemini-Flash-2.5, and 52% to 80% for OpenAI o1. More broadly, shifting to LLMs that generate provably correct conclusions has the potential to dramatically improve their reliability, accuracy and consistency, unlocking complex tasks and critical real-world applications that require trustworthiness.
We demonstrate our ideas in the domain of Euclidean geometry. Our input is a geometry problem, described in both natural language and via a formal representation. The description includes the geometric entities involved (e.g., lines, angles), their relationships (e.g., perpendicular, collinear), and measurements or algebraic expressions over them. We also receive a goal, some quantity to be determined (e.g., the length of a line). In addition, the model has access to a dictionary of theorems that may be used in the proof. The output is a formal proof that derives the goal from the given conditions and theorems, along with the final, numeric answer. The proof consists of steps, each applying a specific theorem from the dictionary.
Our neuro-symbolic approach. Given a target problem from the FormalGeo-7k dataset, we first convert it into an abstract form by replacing entity names (e.g., lines, angles) and specific numeric values with placeholders. We then retrieve structurally similar problems from the abstracted dataset by computing Jaccard similarity over key formal components: construction (entities and geometric relations), conditions (e.g., angle equalities, segment lengths), and goal (the conclusion to be proven). This is based on the observation that structurally similar problems often share proof patterns. The retrieved problems, along with their corresponding formal proofs, are presented to an LLM as in-context examples, together with the available theorems from the Geometry Theorem Dictionary, to guide proof generation for the target problem. Finally, a symbolic verifier iteratively checks the generated proof and provides feedback until a correct proof is produced or a retry limit is reached.
| Model | First run, no retries | First run, w/ retries | Multiple runs, w/ retries | ||||||
|---|---|---|---|---|---|---|---|---|---|
| base1,1 | ours1,1 | Δ | base1,5 | ours1,5 | Δ | base3,5 | ours3,5 | Δ | |
| o1 | 10% | 48% | +38% | 38% | 68% | +30% | 52% | 80% | +28% |
| GPT-5 | 44% | 64% | +20% | 80% | 96% | +16% | 88% | 96% | +8% |
| Gemini-Flash-2.5 | 22% | 48% | +26% | 58% | 74% | +16% | 72% | 86% | +14% |
| Claude Sonnet-4.6 | 28% | 60% | +32% | 58% | 78% | +20% | 78% | 86% | +8% |
Proof accuracy (%) of the base model and our analogy-based method across settings, on 50 FormalGeo-7k problems (10 per difficulty level, 1-5). basei,j denotes the base model (random few-shot examples and the full theorem dictionary) with up to i runs and j verifier-guided retries, while oursi,j denotes our method (retrieved analogies and an analogy-derived theorem dictionary). Δ indicates absolute improvement (percentage points). Our method consistently improves proof accuracy across all models and settings: our complete pipeline (ours3,5) achieves 68%-96% accuracy, compared with 10%-44% for LLM-only baselines (base1,1). Under matched inference budgets with verifier feedback (base3,5 vs. ours3,5), analogical guidance still improves accuracy for every model. At the same time, it substantially reduces the theorem dictionary size (e.g., from ~18K to ~2.5K tokens on average for o1), making the baseline roughly 3× more expensive.
| Setting | Examples | Dictionary | Gemini-2.5-Flash | Claude Sonnet 4.6 | ||||
|---|---|---|---|---|---|---|---|---|
| 1 run | 1 run + retries | 3 runs + retries | 1 run | 1 run + retries | 3 runs + retries | |||
| Ours | Analogies | Analogy-derived | 48% | 74% | 86% | 60% | 78% | 86% |
| (i) | Analogies | Full | 30% | 68% | 78% | 42% | 62% | 78% |
| (ii) | Random | Random-derived | 24% | 54% | 72% | 28% | 60% | 72% |
| (iii) | Analogies | Random (size-matched) | 32% | 60% | 78% | 36% | 66% | 74% |
| Baseline | Random | Full | 22% | 58% | 72% | 28% | 58% | 78% |
Controlled ablation of analogy retrieval and theorem-dictionary construction on 50 problems using Gemini-2.5-Flash and Claude Sonnet 4.6. Our full method performs best across all inference settings. Settings (i) and (iii), which use retrieved analogies, outperform setting (ii), demonstrating the benefit of analogy retrieval, while our gains over (i) and (iii) demonstrate the additional benefit of analogy-derived theorem selection.
OpenAI o1. % correct proofs per level of difficulty (50 samples, 10 per level). Our analogy-based method outperforms the o1 base model (non-analogy) in all settings. Analogy retrieval, verifier feedback, and multiple runs each significantly contributes to performance. Our full pipeline (blue triangle) outperforms the baseline in every level, reaching an average aggregated accuracy of 80%. Even without multiple runs (blue square), performance remains strong at 68%, far exceeding the 10% of the base model baseline (red hollow circle).
GPT-5. % correct proofs per level of difficulty (50 samples, 10 per level). Our analogy-based method outperforms the GPT-5 base model (non-analogy) in all settings. Our full pipeline (blue triangle) outperforms the baseline in every level, reaching an average aggregated accuracy of 96%. Even without multiple runs (blue square), performance remains stable at 96%, far exceeding the 44% of the base model baseline (red hollow circle).
Gemini-Flash-2.5. % correct proofs per level of difficulty (50 samples, 10 per level). Our analogy-based method outperforms the Gemini-Flash-2.5 base model (non-analogy) in all settings. Our full pipeline (blue triangle) outperforms the baseline in every level, reaching an average aggregated accuracy of 86%. Even without multiple runs (blue square), performance remains strong at 74%, far exceeding the 22% of the base model baseline (red hollow circle).
Claude Sonnet-4.6. % correct proofs per level of difficulty (50 samples, 10 per level). Our analogy-based method outperforms the Claude Sonnet-4.6 base model (non-analogy) in all settings. Our full pipeline (blue triangle) outperforms the baseline in every level, reaching an average aggregated accuracy of 86%. Even without multiple runs (blue square), performance remains strong at 78%, far exceeding the 28% of the base model baseline (red hollow circle).
Average number of retries (top) and runs (bottom) per problem by difficulty level, for o1. The dashed line represents maximum allowed. Our analogy-based method consistently outperforms the base model, with fewer retries and runs across all levels: on average, it uses 4.6 retries and 1.58 runs per problem, compared to 8.92 retries and 2.12 runs for the base model.
Error distribution by tier for our method vs. the (o1) base model. Our method reduces errors across all tiers, with tier-1 (syntax) errors being most frequent in both. Tier-1 errors are frequent but easily corrected with verifier feedback, whereas tier-2 (premise violation) errors reflect deeper geometric reasoning failures that often persist across retries.
@article{sultan2025reliable,
title={Reliable Proof Generation with LLMs via Analogical Retrieval and Symbolic Verification: A Case Study in Euclidean Geometry},
author={Sultan, Oren and Stern, Eitan and Shahaf, Dafna},
journal={arXiv preprint arXiv:2505.14479},
year={2025}
}