arXiv:2610.08359cs.LOOct 2026

Manuscript Offprint

arXiv:2610.08359

A First Introduction to Isabelle/ML Metaprogramming: Automatic Estimation of Polynomial Degrees

Jonas Bayer, Anna Danilkin, Marco David, Annie Yao

Abstract

This article offers an introduction to metaprogramming in Isabelle/HOL for beginners, based on a running example for working with multivariate polynomials. The example is motivated by our formalisation of universal Diophantine pairs [1]. We describe the implementation of the poly_degree command, which computes upper bounds on the total degrees of multivariate polynomials and automatically proves their correctness. The complete metaprogram handles a variety of special cases but herein we present a simplified version for the sake of exposition. We describe our development process and design decisions—our goal is to offer a small and self-contained tutorial on Isabelle/ML, for mathematicians who want to get started with metaprogramming.

Keywords: Isabelle/HOL · Metaprogramming · Multivariate Polynomials.

1 Introduction

In this article, we present the basics of metaprogramming with Isabelle/ML. This is a first introduction to the subject, which exemplifies how to programmatically construct terms and propositions, declare new constants and theorems, and automate proving basic theorems about them. The accompanying code can be found on Zenodo. 1^{1}

This tutorial-by-example is based on the metaprogramming infrastructure developed for our previous formalisation of complexity bounds on universal Diophantine pairs [1]. We used Isabelle as a true assistant in constructing the proof, developing much of the formalisation [2] in parallel with our mathematical draft. A corollary of our main result, relying on 50 pages of number theory, is a stronger version of Hilbert's Tenth Problem. In this tutorial, however, we assume no prior knowledge of Diophantine equations or universal pairs, beyond a basic understanding of multivariate polynomials.