The proof that the square root of 2 is irrational is a classic in mathematics, but in recent years it has gained new interest from the perspective of formal software verification. Combining logic theorem provers with large language models (LLMs) opens possibilities far beyond academia. In this case study we analyze how an interaction between an LLM and a theorem prover like LPTP (Logic Program Theorem Prover) allows building a complete formal proof, step by step, and what this means for the development of custom software in business environments.
The process starts with basic definitions in first-order logic, expressed as pure logic programming predicates. On this basis, the LPTP system allows stating properties and proving them through natural deduction, generating human-readable proofs. In our scenario, we start from the definition of rational number and the divisibility relation, then build the classic proof by contradiction: assume √2 = p/q with p and q coprime integers, square both sides, deduce p is even, then q is also even, contradiction.
The interesting part is that the LLM does not perform the proof autonomously but acts as a generative assistant that suggests intermediate steps, corrects rule writing errors, and helps formalize reasoning. The engineer or data scientist reviews, approves, or modifies those suggestions, and the LPTP system rigorously verifies each step. This workflow drastically reduces the time needed to produce formal proofs and eliminates common human errors.
From a technical perspective, integrating an LLM into a formal verification pipeline has profound implications for software reliability. In sectors like banking, healthcare, or aerospace, where a failure can have catastrophic consequences, having mechanical proofs of critical system properties is an increasingly demanded requirement. This is where companies like Q2BSTUDIO offer their expertise in developing AI solutions and integrating formal verification techniques within custom platforms. It is not just about writing code, but about proving that the code behaves as expected under any condition.
The proof of the irrationality of √2 is a simple but illustrative example. The LLM helps translate informal mathematical reasoning into a formal language that the theorem prover can understand. For instance, the LLM can generate the inference rules needed to prove that if a number is even, its square is also even, and vice versa. Then LPTP verifies that those rules are applied correctly. The result is a complete proof that any human with logic knowledge can inspect.
Beyond this concrete case, the synergy between LLMs and formal verification systems points toward a future where artificial intelligence not only generates code but also guarantees its correctness. At Q2BSTUDIO we believe this approach is key for projects requiring high levels of cybersecurity and robustness. Cybersecurity, for example, can benefit from formal proofs to verify that no attack paths exist in a system. Similarly, data analysis with Power BI and process automation become more reliable when business rules are formally verified.
The combination of cloud computing (AWS/Azure) with these methods allows scaling formal verification to complex systems. Instead of proving a small algorithm, one can verify properties of microservice orchestration or real-time data flows. Q2BSTUDIO offers cloud architecture services that integrate these capabilities, making it easier for companies to adopt formal verification without building the entire infrastructure from scratch.
Of course, not everything is perfect. Current LLMs can hallucinate or generate incorrect rules; hence human supervision and mechanical verification are essential. The √2 case shows that even with a general-purpose language model, it is possible to achieve a correct formal proof when a rigorous verifier is in place. This opens the door to more ambitious applications, such as verifying consensus protocols in blockchain or the correctness of cryptographic algorithm implementations.
In summary, the case study of proving the irrationality of √2 with LPTP and an LLM illustrates how artificial intelligence can collaborate with formal methods to improve software quality. For companies seeking to develop custom applications with high reliability standards, this combination represents a competitive advantage. At Q2BSTUDIO we work to integrate these technologies into enterprise solutions, whether through AI agents that assist in verification or through cloud platforms that run formal tests continuously. The result is safer, more predictable software with lower long-term maintenance costs.





