Case study: solving P-99 with LPTP and an LLM

We solved the first 33 P-99 problems by prompting Claude, then proved correctness with LPTP. See how vibe-coding meets vericoding.

sábado, 25 de julio de 2026 • 4 min read • Q2BSTUDIO Team

Vericoding y pruebas formales en Prolog con IA

In the current landscape of software development, the combination of generative artificial intelligence and formal verification methods is opening new frontiers. A particularly revealing case study is the resolution of the classic 'Ninety-Nine Prolog Problems' (P-99) using a large language model (LLM) such as Anthropic's Claude, together with the logical theorem prover LPTP. This experiment not only demonstrates the ability of LLMs to generate logical code, but also builds a bridge between so-called 'vibe-coding' and rigorous verification, an approach that companies like Q2BSTUDIO integrate into their custom software development processes.

The P-99 set, originally developed by Werner Hett and popularized in academia, presents logic programming challenges ranging from lists and trees to arithmetic and reasoning problems. Traditionally, solving them manually required deep knowledge of Prolog and predicate logic. However, in this experiment, informal specifications in English were used as a starting point, and an LLM was asked to generate both the Prolog code and a test file. The result was the creation of 58 logical procedures, 508 tests, and 257 lemmas, totaling over 11,800 lines of formal proof. Each of these files was manually reviewed, running the tests and verifying the proofs with LPTP.

What is interesting about this case is that the LLM not only produced functional code, but also generated proofs for types, termination, uniqueness, existence, and in some cases functional correctness. This goes beyond simple code generation: it involves deep verification of program properties. The term 'vericoding' coined for this practice reflects the intersection between AI-assisted coding and formal quality assurance. From the perspective of Q2BSTUDIO, this methodology is directly applicable to enterprise software projects, where reliability is critical.

One key lesson from the experiment is that LLMs, despite their statistical nature, can be guided to produce coherent logical proofs. However, human intervention remains indispensable: the study's authors verified every generated line, detecting subtle errors in tests and lemmas. This underscores the importance of having expert teams that supervise and validate the work of AI. In this sense, Q2BSTUDIO combines the power of generative models with the experience of its engineers to deliver robust solutions in areas such as artificial intelligence, cybersecurity, cloud AWS/Azure, and Business Intelligence with Power BI.

The practical application of this approach extends beyond Prolog. In custom software development, for instance, the ability to generate formal proofs from natural language specifications could drastically reduce verification costs and increase confidence in the software. Companies like Q2BSTUDIO are already exploring these techniques to automate parts of the testing process and ensure that code meets security and performance requirements. Furthermore, integration with cloud platforms like AWS or Azure allows scaling these verifications in continuous integration environments.

Another notable aspect is the generation of AI agents that can reason about their own code. The P-99 experiment shows that an LLM can act as a proof assistant, producing lemmas and proofs that are then validated by an external prover. This is a step towards more autonomous and reliable AI systems, an area where Q2BSTUDIO actively invests, developing intelligent agents to automate complex business processes.

From a cybersecurity perspective, formal verification provides guarantees that the code contains no logical vulnerabilities. By combining generation with LLMs and proof with LPTP, software behavior can be audited at an abstract level, detecting potential failures before deployment. Q2BSTUDIO integrates these practices into its pentesting and security services, providing clients with an additional layer of trust.

In the field of Business Intelligence, generating queries and data transformations from natural language is a growing trend. Although the case study focuses on Prolog, the same techniques can be applied to languages such as SQL or DAX, where correctness verification is equally important. Q2BSTUDIO uses AI tools to accelerate the development of dashboards and reports in Power BI, ensuring that generated formulas and measures align with business logic.

Finally, the experiment with P-99 and LPTP highlights the need for a hybrid approach: the creativity and intuition of the LLM combined with the formal rigor of the prover. At Q2BSTUDIO, this principle guides custom software development, prioritizing both innovation and quality. The company offers services ranging from idea conception to cloud deployment, including artificial intelligence integration and process automation. Thus, cases like the resolution of P-99 are not merely academic curiosities, but concrete examples of how technology can transform the way we build reliable and efficient software.

A BREAK?

Play for a moment before you go

OUR SERVICES

How we can help you

Do you have a project in mind?

Tell us your vision and we'll turn it into a software solution. Whatever the scope, we make your idea real.