CodeX 20th Anniversary Series: Computational Law’s Next Model Layer?

A Foreword by Stanford CodeX Associate Director, Dr. Megan Ma

As the Stanford Center for Legal Informatics (CodeX) celebrates its 20th anniversary in 2025, we are excited to commemorate and build upon two decades of groundbreaking work at the intersection of law and technology. CodeX has grown into a globally recognized leader in the field of computational law – pushing the boundaries of what is possible when we harness the power of data, formal logic, algorithms, and intelligent systems to transform the practice and study of law.

Over the course of this Special Anniversary series, we will take a journey through CodeX’s past, present, and future. We’ll revisit the visionary ideas and pioneering research that laid the foundations of computational law and explore how these early efforts have blossomed into real-world applications that are reshaping the legal landscape. More importantly, we’ll peer into the frontier, revealing the ambitious plans and cutting-edge research that we hope will usher CodeX’s paths ahead.

Most importantly, this series will demonstrate that the future of law is not one of robots replacing lawyers, but rather of humans and machines working in concert to advance the mission of legal empowerment. CodeX has been at the vanguard of this transformation, and as we celebrate over two decades of innovation, we invite you to join us in imagining the possibilities that lie ahead.

The first post of this series will be kicked off by none other than our 2024 CodeX Prize winner, Professor L. Thorne McCarty.

Computational Law’s Next Model Layer?

by Professor L. Thorne McCarty

Recently, my article on “Clustering, Coding, and the Concept of Similarity” was published in Annals of Mathematics and Artificial Intelligence (2024). This is the first in a series of three articles. The second article is: “Differential Similarity in Higher Dimensional Spaces: Theory and Applications,” and the third article is: “Manifold Logic and the Theory of Differential Similarity.” I will discuss these three articles in the subsequent comments.

Here is an overview: Probability, Geometry, Logic. The first wave of AI was based on Logic, the second wave was based on Probability, and there have been a number of attempts over the years to combine the two into a single formalism.

What is novel here is Geometry: The geometric model is built on top of the probabilistic model, and the logic is built on top of the geometry. The key issue then is: How to construct the interfaces between these three models? Also, we want to extend this stack recursively, so that the logic supports another probabilistic layer.

CodeX 20th Anniversary Series: Computational Law’s Next Model Layer?

More precisely, the three models are based on stochastic processes, differential geometry, and category theory, respectively. The mathematics is fairly sophisticated, but I gave a short non-technical exposition of the main ideas in my remarks at CodeX 2024 a couple of weeks ago. This might be a good place to start, if you are interested in exploring the theory.

[VIDEO: FutureLaw 2024 CodeX Prize]

The first article, on “Clustering, Coding, and the Concept of Similarity,” develops the basic mathematical theory and studies the interface between the probabilistic and the geometric models. The discussion is restricted to three dimensions, however, so that it is easier to visualize.

CodeX 20th Anniversary Series: Computational Law’s Next Model Layer? 1

The link to the paper may be found here. If you do not have institutional access to this journal, here is a link to an online read-only version of the paper.

CodeX 20th Anniversary Series: Computational Law’s Next Model Layer? 6

The coordinate system for the geometric model uses a form of Prototype Coding.

We measure the distance from the prototype, the rho coordinate, in a number of specified directions, the Theta coordinates.The Riemannian dissimilarity metric measures increments of equal probability along the rho coordinate curves, and the Theta coordinate curves are geodesics (or shortest paths) along the surface of constant probability density.

This geometry works because of the Frobenius Theorem, an important result from 19th century differential geometry. As a corollary to the Frobenius Theorem, we can show that the “Frobenius integral manifold” is identical to the surface of constant probability density. Thus, the geometric model matches the probabilistic model exactly.

The second article, on “Differential Similarity in Higher Dimensional Spaces: Theory and Applications,” extends the theory to the general n-dimensional case. This makes a big difference.

CodeX 20th Anniversary Series: Computational Law’s Next Model Layer? 2

Here is a link to the paper. Here it is on arXiv.

Be sure to read Version 4.0 of this preprint, which is a revision to match the published version of the first article.

In the MNIST example, we start with 600,000 7X7 patches and sort them into 35 “prototypical clusters,” each one defined by a rho coordinate and 48 Theta coordinates. We then show how to reduce the dimensionality to 12 by finding subclusters with 11 optimal Theta coordinates.

CodeX 20th Anniversary Series: Computational Law’s Next Model Layer? 3

In the CIFAR-10 example, we add two new features to the theory: quotient manifolds and product manifolds. Quotient manifolds are used to build invariance into the geometric model, consistent with known properties of the probabilistic model. Product manifolds are used to combine low dimensional solutions into a higher dimensional problem space, so that our dimensionality reduction techniques can be applied recursively. We illustrate this procedure in the CIFAR-10 example by computing optimal 12-dimensional submanifolds in each R/G/B color channel, and then reducing the dimensionality of the product manifold again from 36 to 12.

In each case, the theory of differential similarity gives us a reasonable characterization of the “optimal” submanifold, consistent with both the geometric model and the probabilistic model.

The third article, on “Manifold Logic and the Theory of Differential Similarity,” is still an incomplete draft, but I have circulated copies to a few people for initial comments. I expect to finish this paper and post it as a preprint in the next couple of months.

CodeX 20th Anniversary Series: Computational Law’s Next Model Layer? 4

In the meantime, you can read an early summary of the logic in Section 3 of my paper from ICAIL 2015 here. Or, you can read a less technical summary in the Michigan State Law Review here.

These two references also show how the theory of differential similarity is related to prior work on AI and Law.

Here is a simple illustration of the interface between the geometry and the logic:

CodeX 20th Anniversary Series: Computational Law’s Next Model Layer? 5

In the MNIST example, assume that Patch23 is a manifold and ?P23 refers to a point on this manifold, and likewise for the other three patches. The image of the digit FOUR is then a submanifold of the product manifold of the four patches, arranged in a 2X2 array. But that’s exactly what is represented by the logical expression on the left. In a classical logic, a predicate is a subset of the Cartesian product of its arguments. In a manifold logic, a predicate is interpreted as a submanifold of the product manifold of its arguments, in exactly the same way.

Therefore, working within a categorical logic, we are just replacing sets and their elements with manifolds and their points.