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

· Source: Artificial Intelligence · Field: Technology & Digital — Artificial Intelligence & Machine Learning, Software Development & Engineering, Mathematics & Computational Sciences · Depth: Expert, quick

Summary

An experiment successfully solved the first 33 problems of the Ninety-Nine Prolog Problems (P-99) using Claude from Anthropic, a Large Language Model, in conjunction with LPTP (Logic Program Theorem Prover). The process involved prompting Claude with informal English specifications to generate Prolog code and corresponding test files. These tests were then run, and LPTP was used to formally prove types, groundness, termination, uniqueness, existence, and sometimes functional correctness of the generated code. This "vibe-coding/vericoding" approach resulted in Claude producing 58 logic procedures, 508 tests, and 257 lemmas, totaling 11800 proof lines, all manually checked for accuracy and proof-checked with LPTP.

Key takeaway

For Research Scientists exploring AI-assisted code generation, this case study demonstrates a robust methodology for ensuring reliability. You should integrate formal verification tools like LPTP into your LLM-driven development workflows to validate generated code for critical properties such as termination and correctness. This approach mitigates risks associated with "vibe-coding" by providing concrete proof of code quality.

Key insights

Combining LLM code generation with formal verification significantly enhances code reliability and correctness.

Principles

Method

Prompt an LLM with informal specifications to generate code and tests. Run tests, then use a formal prover like LPTP to verify properties such as types, termination, and functional correctness.

In practice

Topics

Best for: AI Scientist, Research Scientist, NLP Engineer

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by Artificial Intelligence.