Remix.run Logo
Show HN: Formally verified polygon intersection – Opus 4.8 oneshots, prev failed(github.com)
31 points by permute 2 hours ago | 5 comments

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.

prewett 18 minutes ago | parent | next [-]

This is a great use for AI! Calculating intersections is tedious and there are an surprising number of edge cases that are tedious to track down and fix.

CyLith 2 hours ago | parent | prev | next [-]

Does this use integer coordinates or floating point coordinates?

threatripper an hour ago | parent [-]

It uses exact rational coordinates, not floating-point coordinates in the verified core. See: https://github.com/schildep/verified-polygon-intersection/bl...

porcoda 13 minutes ago | parent [-]

I am eager for a lean equivalent of flocq in rocq. When I did some lean verification of numerical algorithms I did the same thing with rationals or the reals from mathlib. The big gap between that and the actual code is the lack of a solid theory library to pull in that would give me IEEE floats that is at the same level of quality as Flocq. I’m eager for that to come along (unless it has and I just haven’t found it yet).

olaird25 an hour ago | parent | prev [-]

Is the web demo compiled from the lean?