{"slug": "a-summer-with-claude-and-relative-arbitrage-by-dmitriy-traytel", "title": "A Summer with Claude and Relative Arbitrage, by Dmitriy Traytel", "summary": "Dmitriy Traytel, working under a Renaissance Philanthropy-funded project on Copilots for Isabelle, used Anthropic's Claude models with Kevin Kappelmann's PIDE MCP component to autoformalize the main result of a not-yet-published paper on the relative arbitrage problem under eigenvalue lower bounds into a finished Isabelle/HOL proof in three weeks, producing over 100,000 lines of proof. Traytel ran Claude nearly non-stop on a Claude Max 5x subscription, with Claude Fable 5 drafting within its token limits and Claude Opus 5 (starting from Opus 4.8) taking over from the current proof state, notes and plans; the prompt was essentially \"Formalize https://arxiv.org/abs/2512.17702 in Isabelle using PIDE MCP.\" The proof, covering Theorem 1.1 from the joint article by Misha Shkolnikov, Jou-Hua Lai and H. Mete Soner, is published at github.com/dtraytel/relative_arbitrage.", "body_md": "In our Renaissance Philanthropy-funded project\n[Copilots for Isabelle](https://www.renaissancephilanthropy.org/copilots-for-isabelle-learning-logical-structure-for-a-better-proving-experience),\nwe develop methods and tools that allow AI agents to conveniently interface with Isabelle.\nOne major outcome of the project so far is Kevin Kappelmann’s\n[PIDE MCP](https://github.com/kappelmann/isabelle-pide-mcp) component<sup>[1](#fn:1)</sup>,\nwhich presents AI agents with a live view of Isabelle much like we human users have it\nthrough Isabelle/jEdit. I am trying to keep Claude entertained through\n((semi-)auto-)formalization case studies using this tool; this was also the goal for my\nsummer vacation (with a week of FLoC in the middle) where I was looking for a larger\nproject on which Claude could work rather independently for a longer period of time.\nAnd one I would be reasonably detached from, so that I would not have the urge to\ncheck on the agent every hour.\n\nMy second cousin [Misha Shkolnikov](https://www.math.cmu.edu/~mshkolni/) recently\ngave a talk at the\n[Mathematics for the Real World 2026](https://www.sdu.dk/en/forskning/qm/events/icmu-conf-2026)\nconference. On his way to Odense, he stopped in Copenhagen so that I could give him a\nsmall tour of the city. Knowing before the summer that Misha was coming to visit, I\ndecided to prepare a surprise: I asked Claude to autoformalize, in Isabelle using PIDE MCP,\nthe main result of his joint article with Jou-Hua Lai and H. Mete Soner (not-yet-published,\nbut in the final stages of the publication process) on the\n[Relative arbitrage problem under eigenvalue lower bounds](https://arxiv.org/abs/2512.17702).\n\nMandatory note here: I am quite clueless about financial mathematics and probability theory in general, let alone stochastic portfolio theory and relative arbitrage: e.g., I learned from the article’s first sentence that\n\nFernholz has introduced the concept of portfolio domination, now more commonly referred to as relative arbitrage, to rigorously capture the notion of “beating the market”.\n\nI picked this particular result for the aforementioned detachment reasons, but also because it scored highly along the “recent work”—”short proof” curve among Misha’s recent papers available on arXiv.\n\nThree weeks and over 100 000 lines later I had a\n[finished Isabelle/HOL proof](https://github.com/dtraytel/relative_arbitrage).\n\nClaude was working nearly non-stop during these three weeks. I used a Claude Max 5x subscription over the summer, which has since been replaced by the Claude Team plan for scientists. The workflow was: Claude Fable 5 drafted as much as it could within its harsh token limits. When those were exhausted, Claude Opus 5 (I may have started with Opus 4.8) took over based on the current proof state, notes, and plans that Fable developed. Generally, my prompt was more or less “Formalize https://arxiv.org/abs/2512.17702 in Isabelle using PIDE MCP” followed by numerous encouragements to keep going and occasional suggestions to look at the Archive of Formal Proofs before formalizing a new concept. I am in no position to discuss the mathematical aspects of this autoformalization, but I have something to say about the outcome and the challenges along the way (which will include some mathematics in case you are here solely for that purpose).\n\nThe main result, Theorem 1.1, itself has a rather complex statement. Here it is, with HTML generated from Isabelle (while hiding comments). Feel free to skip it; there is not enough context given here anyway to understand it fully. I include it here for completeness and to give a flavor of how things look.\n\n```\ntheorem theorem_1_1:\n  fixes K :: \"(real^'n::finite) set\"\n  assumes kn: \"k < CARD('n)\" and L1: \"1 ≤ L\" and k1: \"1 ≤ k\"\n    and cK: \"compact K\"\n  defines \"v ≡ (λz. enn2real (xval k L K z))\"\n  shows \"(∃B :: real. ∀y. xval k L K y ≤ ennreal B)\n       ∧ (∀c z. v z < c ⟶ (∃e>0. ∀y. dist z y < e ⟶ v y < c))\n       ∧ visc_subsol_env2 k L K\n           (interior K ∪ {x ∈ K - interior K. 0 < v x}) v\n       ∧ visc_supersol_env2 k L K\n           (interior K ∪ {x ∈ K - interior K. lsc_envK K v x < 0})\n           (lsc_envK K v)\n       ∧ (expandable K ⟶\n          (∀u :: real^'n ⇒ real. ∀Bd.\n            (∀c z. z ∈ K ⟶ u z < c ⟶\n               (∃e>0. ∀y∈K. dist z y < e ⟶ u y < c))\n            ⟶ (∀y∈K. ¦u y¦ ≤ Bd)\n            ⟶ visc_subsol_env2 k L K\n                 (interior K ∪ {x ∈ K - interior K. 0 < u x}) u\n            ⟶ visc_supersol_env2 k L K\n                 (interior K ∪ {x ∈ K - interior K. lsc_envK K u x < 0})\n                 (lsc_envK K u)\n            ⟶ (∀x∈K. u x = v x)))\"\n```\n\nThe formalization\npulls in material from HOL-Analysis and HOL-Probability, but also six AFP entries:\nDisintegration, Kolmogorov_Chentsov, Levy_Prokhorov_Metric, Lower_Semicontinuous,\nMartingales, Standard_Borel_Spaces. I tasked Claude to explain the definitions that were\nintroduced on top of these dependencies and to compare the statement to the one from the\npaper in a visual/interactive way. The output is\n[available here](https://lawrencecpaulson.github.io/assets/theorem_1_1_unfolded.html) and I find it surprisingly readable in that it contextualizes things better than Isabelle’s unprocessed HTML output.\nI am particularly fond of the nested tooltips to explore definitions (something I suggested to\nClaude)—we need deterministic tools that generate such a presentation of formal\nmaterial. Fortunately, Isabelle/PIDE has all the markup we need already, so this is really\na question of presentation.\n\nThe main question with any autoformalization is whether the theorem states the right result: I believe that it does after eyeballing the paper and the formal definitions. And after showing a more static PDF variant of the above document to Misha, the belief has only grown stronger. Needless to say, Isabelle checked the proofs, so fortunately I did not need to study those carefully.\n\nClaude’s original formulation was spread over five lemmas with different assumptions. Two interesting things happened:\n\n`(∃B :: real. ∀y. enn2real (xval k L K y) ≤ B)`, which does not\nachieve the intention to state that `xval` never returns ∞ because the\nconversion `enn2real` from extended non-negative reals to reals assigns\n`0::real` to `∞::ennreal` in Isabelle (a standard\n“totalization” completion\n`xval k L K y` is never\n∞. It just managed to forget this when stating the final lemma. After realizing the\nissue, it was thus immediate to obtain the current formulation with the embedding of reals into extended non-negative reals\non the right of the inequality.\nThe first complete proof had over 100 000 lines, which sounds impressive by human standards.\nFrom the start, I doubted that it had to be that long. Restructuring eventually shrank it by about a third (see below), although I never pushed very hard for really concise proofs.\nI did instruct the agents to iteratively remove lemmas that were flagged as unused when looking at\nthe theorem dependencies (`unused_thms`). There were some in the end but not too many. Granted, the\nagents had to develop a lot of infrastructure that the authors assume to be pre-existing. And\nthis is not counting advanced analysis and probability theory that was already in Isabelle\nand the AFP. On several occasions the authors’ proofs are of the form: “repeat\nthe Larsson–Ruf argument word-by-word”, which required the agents to read more\nthan the 17-page paper—so the de Bruijn factor may be smaller than it sounds.\n\nThe proofs the agents write consist of rather small steps. Here are for example the five most frequently used proof methods along with the number of occurrences in the current formalization:\n\n```\n6736 rule\n6469 simp\n1621 intro\n1318 blast\n 917 auto\n```\n\nOf course, different authors have different proof styles. My typical proofs consist of\nmore `auto` s and fewer `rule` s, here e.g., in\n[VeriMon](https://bitbucket.org/jshs/monpoly/src/master/thys/)\n(68 000 lines of Isabelle):\n\n```\n6962 auto\n2502 simp\n1259 cases\n 909 blast\n 890 rule\n```\n\nApart from the need to deal with huge amounts of formal material, having small-step proofs\nis not necessarily a bad thing. In fact, proof processing is very efficient:\n`isabelle build` including document preparation finishes in under five minutes on\nmy machine.\n\nThe [first completed proof](https://github.com/dtraytel/relative_arbitrage/tree/af1bae57eacece10892a88759e9a4d2b86fee4e1)\nconsisted of 64 theories dumped in a single session. I instructed the agents to separate\ngenerally reusable material from things that are specific to the proof and to use these abstractions\nand generalization to shrink the material. This exercise was repeated multiple\ntimes as new models would be released (e.g., Claude Opus 5.5). After these improvements, the\nformalization currently consists of only 85 000 lines structured in 12 sessions, \nof which 9 could become “library-style” AFP entries (roughly 70 000 lines together), \ntwo formalize the main result (13 000 lines), and one presents the result in the paper’s notation\n(1 800 lines). I write “could” because it is not clear to me whether this material\nbelongs to the AFP *in the current form*, and I fear that I might not have enough\nunderstanding of the material to bring it into the desired form. I welcome any contribution\nfrom experts on such material (I’m thinking, e.g., of the authors of the entries the\nformalization uses), although I don’t want to force a formalization that may contain\nAI slop on anyone. I’m also trying to be conservative when it comes to AFP\nsubmissions because, as an AFP editor, I already see how much AI-generated material we are\nreceiving—not all bad, but also by far not all good.\n\nMisha tells me that second-order viscosity analysis, in particular the Crandall–Ishii(–Lions) result, is a standard and widely used tool in stochastic optimal control. This makes me hopeful that the present autoformalization can be useful for future formalizations in this area.\n\nPerhaps the most human trait of LLM agents is their laziness. When making TODO lists, the agents will structure them in such a way that low-hanging fruit is handled first, creating an illusion of fast progress. An example is Crandall–Ishii, which the agents had enormous respect for and thus kept postponing. Eventually, there was no way around it, but amusingly the agents went for the bare minimum and formalized only the core argument needed for Theorem 1.1, not the full Crandall–Ishii theorem. After Misha told me about Crandall–Ishii’s importance, I instructed the agents explicitly to fill this gap.\n\nIn other places, the laziness actually paid off. The agents managed to avoid formalizing stochastic integrals and Itô’s formula, both used in the paper. I cannot really say what they did instead (and whether it was better, worse, or mathematically interesting). Claude has mixed feelings about this and justifies it with the claim that developing this “Itô-calculus” machinery, which Isabelle lacks, would be a substantial project.\n\nTechnologically, PIDE MCP was the perfect interface for the autoformalization part of the\njob. The MCP server gave the agents up-to-date access to Isabelle’s feedback on their edits.\nPeople using agents with `isabelle build` frequently want to single out\nnon-terminating commands by introducing timeouts. Every now and then agents would produce\nnon-terminating proofs (often when using `blast`), but PIDE MCP makes it easy for\nthem to detect these issues by labeling the offending commands as “potentially\nnon-terminating” (whereas PIDE’s standard terminology is “running”,\nwhich has a positive connotation that may confuse agents: when something is running it is often\na good thing). The later refactoring bits proved more challenging: dynamic handling of sessions\nwas not yet supported by PIDE MCP at the time (it is now), so every structure change required\na restart of the MCP server (and thus a restart of Claude Code).\n\nThis formalization was an odd experience. I consider myself an experienced formalizer and for me, completing a formalization is always accompanied by a sense of accomplishment, ownership, and understanding: now I really know how it works! These aspects were to a large degree absent here. Sure, in some sense it is satisfying to see the agents tick off boxes from their own TODO lists. But it is not the same as doing it oneself. Also, at times boxes get replaced by more boxes—a real Hydra fight typical of a large proof development—but without the understanding these boxes mean relatively little and one does not get a good grip on whether we are converging towards the goal or the agents just engage us in burning more tokens. (The agents have mixed success when estimating difficulty and their own capabilities.) In terms of learning how things work: I certainly learned some things while watching the agents work on the formalization: likely enough to understand the theorem statement, but not enough to distinguish which parts of the proof are reusable and which ones are specific to the theorem.\n\nOdd things also happen in the brains of these machines. I get particularly annoyed when the\nthinking trace is shown and I see “thoughts” like “Writing Lean\nproof.” or complaints like “nlinarith is not available in this version of\nIsabelle”. At no point did I catch the agents actually mistaking Lean’s syntax\nfor Isabelle’s—these artifacts did not make it out of the\n“thoughts”—but they constitute a reminder that these machines may not be\nas intelligent as their proof assembly capabilities suggest. A point Larry will\nappreciate: even during thinking, none of the agents ever complained about\n[Isabelle’s lack of dependent types](https://lawrencecpaulson.github.io/2025/11/02/Why-not-dependent.html).\n\nWhere does one go from here? It seems feasible to obtain formalizations of recent\nmathematical results with bounded resources.<sup>[2](#fn:2)</sup> Looking at the cost question in more detail,\nthe subscription cost of $100 monthly must be contrasted with the (much higher) calculated API cost: Claude estimates\n$7 500, with roughly 9.7 billion input tokens and 20 million output tokens\ndistributed over 30% Fable and 70% Opus (the same distribution is observed\nwhen attributing Isabelle lines to models that produced them)—here we are not counting the\ncleanup and restructuring that followed the first proved version of Theorem 1.1.\n\nWhich results should we focus on for this price? Many formalizers will\ncare about the structure of the proof. The particular exercise seems to have been useful to\nMisha to straighten out the *L* = 1 case, regardless of the formalized proof\nstructure. From the proof assistant perspective it is also interesting to compare\ntechnologies and libraries. Would it be cheaper, for instance, to autoformalize the same result in\nLean? Also better tool support, especially for refactoring and making sense of definitions\nand statements, is dearly needed.\n\nI included some critical thoughts above, but want to end on a positive note: the paradigm shift that these funny machines bring to proof assistants makes the work of our community more relevant than ever: formal proofs will be everywhere and easy to generate, also by non-experts. We just need good tools for inspecting and assessing the quality of the results and an army of domain experts to sieve through the mud and find the gold nuggets.\n\n*Acknowledgements*.\nThanks to Mohammad Abdulaziz, David Basin, Kevin Kappelmann, and Misha Shkolnikov for comments on earlier drafts of this article.\n\nAnother useful MCP for Isabelle is [I/Q](https://github.com/awslabs/AutoCorrode/tree/main/iq). Have a look at the [PIDE MCP preprint](https://zenodo.org/records/21519365) for an architectural comparison of PIDE MCP, I/Q, and other viable approaches connecting agents to Isabelle. [↩](#fnref:1)\n\nSince this summer, big tech companies have showcased that with unreasonable amounts of resources and in part using internal, unpublished models one can jump even higher and run even faster. Here, I report on using the technology they make available to ordinary subscribers. [↩](#fnref:2)", "url": "https://wpnews.pro/news/a-summer-with-claude-and-relative-arbitrage-by-dmitriy-traytel", "canonical_source": "https://lawrencecpaulson.github.io//2026/10/26/Relative_arbitrage.html", "published_at": "2026-10-26 00:00:00+00:00", "updated_at": "2026-10-26 15:11:59.687316+00:00", "lang": "en", "topics": ["artificial-intelligence", "ai-agents", "ai-tools", "ai-research", "agent-protocols"], "entities": ["Dmitriy Traytel", "Claude", "Anthropic", "Isabelle", "PIDE MCP", "Kevin Kappelmann", "Misha Shkolnikov", "Renaissance Philanthropy"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/a-summer-with-claude-and-relative-arbitrage-by-dmitriy-traytel", "markdown": "https://wpnews.pro/news/a-summer-with-claude-and-relative-arbitrage-by-dmitriy-traytel.md", "text": "https://wpnews.pro/news/a-summer-with-claude-and-relative-arbitrage-by-dmitriy-traytel.txt", "jsonld": "https://wpnews.pro/news/a-summer-with-claude-and-relative-arbitrage-by-dmitriy-traytel.jsonld"}}