← Latest papers
⚛️ quantum physics

Building Shor's Algorithm in Lean: An Agentic Formalization of Quantum Attacks on RSA-2048 and P-256

This paper presents an agentic formalization of Shor's algorithm in Lean, where AI agents assisted by human review successfully machine-checked the mathematical foundations and logical resource estimates for quantum attacks on RSA-2048 and P-256, paving the way for AI-assisted design and verification of quantum algorithms.

Original authors: Lei Zhang, Yusheng Zhao, Hongshun Yao, Xin Wang

Published 2026-07-16
📖 4 min read🧠 Deep dive

Original authors: Lei Zhang, Yusheng Zhao, Hongshun Yao, Xin Wang

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine the digital world as a giant, invisible fortress protecting everything from your bank account to secret government messages. The locks on this fortress are mathematical puzzles so complex that, with today's supercomputers, cracking them would take longer than the age of the universe. These puzzles are the backbone of modern security, specifically two famous types: RSA, which relies on the difficulty of multiplying two huge prime numbers together, and Elliptic Curve cryptography, which uses the tricky geometry of curves drawn on a grid of numbers. For decades, we've believed these locks are unbreakable. But there's a theoretical "master key" in the world of quantum physics called Shor's Algorithm. It's like a magical tool that, if built, could solve these puzzles in minutes instead of eons. The problem is, building a real quantum computer is incredibly hard, and proving that our mathematical blueprints for this "master key" are actually correct is even harder. This is where a new kind of detective work comes in: using artificial intelligence to help mathematicians write "machine-checked" proofs. Think of it as having a robot lawyer that reads every single step of a legal argument to ensure there isn't a single typo or logical gap, guaranteeing that the math is 100% solid before we ever try to build the machine.

This paper is about a team of researchers who used a team of software agents (AI helpers) to build a rigorous, machine-checked version of Shor's Algorithm specifically for breaking two of the most common digital locks in the world: RSA-2048 and P-256. They didn't just guess how it would work; they used AI to read scientific papers, write code in a language called Lean, and then have a computer verify every single logical step to ensure the math holds up. Their goal was to create a "blueprint" that proves exactly how many resources a quantum computer would need to crack these specific locks.

For the RSA-2048 lock, which protects much of the internet's current infrastructure, the team's formalized blueprint shows that a quantum computer would need about 6,190 logical qubits (the quantum version of computer bits) and would have to perform a staggering 8.1 billion Toffoli gates (a specific type of quantum logic operation). If you ran this process three times in a row to be safe, the total depth of the circuit would be 6.42 billion steps. The math proves that this method would successfully find the secret key at least 2 out of 3 times.

For the P-256 lock, which is used in many secure websites and digital signatures, the requirements are even more intense. Their formalized proof indicates that breaking this lock would require 2,330 logical qubits and a massive 126 billion Toffoli gates, with a circuit depth of 116 billion steps. Just like with RSA, the algorithm is proven to succeed with a probability of at least 2/3. Interestingly, once the quantum computer does its heavy lifting, the human (or classical computer) part of the job is surprisingly small, requiring only 7 simple arithmetic steps to finish the job.

What makes this work special is not just the numbers, but how they got them. Instead of a human writing a long paper and hoping no one finds a mistake, they used an "agentic" system. Software agents acted like junior researchers: they hunted down source material, broke down complex claims into tiny pieces, wrote the Lean code, and even tried to fix errors in the proofs. Humans then reviewed the scientific logic, while the computer checked the code. The result is a library of math that is "machine-checked," meaning a computer has verified every single link in the chain of logic.

The paper is careful to note that this is a theoretical victory, not a practical one. They haven't built the quantum computer yet, nor have they actually cracked a real RSA-2048 key. Instead, they have built the ultimate "proof of concept" that says, "If we ever build a quantum computer with these specific resources, here is exactly how it will break these locks, and here is the mathematical guarantee that it will work." They also clarify that their numbers are based on "logical" resources, which are the idealized requirements before you add in the messy reality of fixing errors caused by noise in the machine. This work doesn't mean your passwords are safe tomorrow, but it does mean that if we ever get the quantum hardware, we will have a perfectly verified map showing exactly how to use it to break the world's most common digital locks.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →