Show HN: Formally verified polygon intersection – Opus 4.8 oneshots, prev failed

permute 43 points 6 comments June 04, 2026
github.com · View on Hacker News

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.

Discussion Highlights (4 comments)

CyLith

Does this use integer coordinates or floating point coordinates?

olaird25

Is the web demo compiled from the lean?

prewett

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.

deterministic

Impressive work. It's nice to see LEAN being used for real-world algorithms.

Semantic search powered by Rivestack pgvector
10,002 stories · 93,925 chunks indexed