Hacker News new | ask | show | jobs
by fractallyte 51 days ago
Interesting synchronicity: I've written a patent-drafting DSL which exactly parallels this – and which is now shaping up into an "IDE" for patent drafting...

Patent texts read as prose, but are actually precisely structured legal documents. The latest developments in this domain involve LLMs to create and modify patent documents, but even though the legal profession seems to have fallen all in on it, it's essentially rather fragile and error-prone.

I've gone the deterministic direction, which has opened up some very cool, previously unexplored, possibilities!

2 comments

> Patent texts read as prose, but are actually precisely structured legal documents.

at that point why not just use something precise like a programming language? have there been efforts in that direction? genuine questions

I have no idea.

A few months ago, for the first time in my life, I had to write a patent document. It was very complicated – too complicated. Noting the structure, I searched for tools, but found only LLMs. So I wrote my own tool.

The amusing thing is, LLMs prefer the DSL-structured document!

Yes (not patents in particular).

The name is "law as code".

(My impression: various approaches; mostly academic; some small companies in the space; judging from a loose assessment wrt my career choices as a freelancer: no real business opportunity yet)

Interesting indeed! What have you learned from the patent space and what kinds of questions can you answer after perhaps solving that domain?
Patents are a much smaller space than the vast legal one in the article, so it's tractable for a human. The raw DSL spec length is roughly comparable to Lua or Go. It's a genuine grammar, with types and an AST; but no conditionals, control flow, expressions, etc. like a regular programming language.

A patent document can be represented in a graph. That opens it up to various transformations, refactoring, and validation – all mathematically rigorous! This is far more reliable than asking an LLM to check a document.

Using git enables not only regular diffs, but also structural diffs, which compare legal elements rather than just lines.

The LSP (yes, that too!) makes drafting much easier, with autocomplete and validation as I type.

I plan to open-source the DSL, and the tool that processes its files and outputs jurisdiction-aware, nicely formatted documents...