To my knowledge, this is the first formally verified implementation of an intersection algorithm for polygons.
The experience of working with AI agents on this project changed a lot with recent model releases, as I describe in the readme. Opus 4.8 is able to provide algorithm implementation with formal proof in one shot, whereas previous models required me to provide proof strategies in multiple steps.
Trust in the correctness comes entirely from the Lean checker and human review of a small specification, not from the LLM.
Also check out the web demo built around the verified core linked in the readme: https://schildep.github.io/verified-polygon-intersection/. It supports multipolygons including holes, self intersections, and overlapping edges.
For example, if one allows one coordinate of one corner to be non rational, I think the set of potential output coordinates used would be a subset of the reals (depending on the value of that coordinate), and to my (possibly very bad) intuition, formalizing that subset doesn’t feel like a hard problem.
Allowing two of such real points would make things more tedious, potentially way more tedious, but again, doesn’t feel like it would be impossible to handle.
reply