Can Large Language Models Learn Formal Logic? A Data-Driven Training and Evaluation Framework

Yuan Xia, Akanksha Atrey, Fadoua Khmaissia, Kedar S. Namjoshi
4/28/2025
cs.LGcs.AI

No confident code implementation found for this paper. 4 possible matches can be shown below.

Abstract

This paper investigates the logical reasoning capabilities of large language models (LLMs). For a precisely defined yet tractable formulation, we choose the conceptually simple but technically complex task of constructing proofs in Boolean logic. A trained LLM receives as input a set of assumptions and a goal, and produces as output a proof that formally derives the goal from the assumptions. Incorrect proofs are caught by an automated proof checker. A critical obstacle for training is the scarcity of real-world proofs. We propose an efficient, randomized procedure for synthesizing valid proofs and introduce Template Transformation, a data augmentation technique that enhances the model's ability to handle complex logical expressions. The central evaluation question is whether an LLM has indeed learned to reason. We propose tests to measure the reasoning ability of a black-box LLM. By these measures, experiments demonstrate strong reasoning capabilities for assertions with short proofs, which decline with proof complexity. Notably, template transformation improves accuracy even for smaller models, suggesting its effectiveness across model scales.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 4 weaker matches are hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Cite this paper

@article{xia2025large,
  title  = {Can Large Language Models Learn Formal Logic? A Data-Driven Training and Evaluation Framework},
  author = {Yuan Xia and Akanksha Atrey and Fadoua Khmaissia and Kedar S. Namjoshi},
  year   = {2025},
  eprint = {2504.20213},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2504.20213v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2504.20213.svg)](https://codeofpaper.com/paper/2504.20213)

Discussion