Better HN
topnewbestaskshowjobs
Log inSign up

solomonb

1,325 karma · joined Dec 2, 2019 (6y ago) · 534 submissions

Software engineer with interests in programming language theory and type theory.

I also like compost.

and radio.

blog.cofree.coffee www.kpbj.fm www.kchungradio.org

ssbothwell_at_gmail_dot_com

Submissions

comment 1d ago · link · parent

I agree that a clear account is the right starting point for understanding a proof of this size. But that's true of any large artifact, and it doesn't make the formal code analogous to compiled output.

Nobody would try to understand a 17M line Javascript application by reading it top to bottom either. You'd want design and architecture docs first. That doesn't make Javascript equivalent to assembly, nor does it mean the code is not meant to be read and understood. The difficulty comes from scale and structure.

Lean, Agda and similar languages are high-level languages for writing mathematics. You write definitions, lemmas, theorems, etc. A well organized formalization can be read in the same way as one reads a well organized software application.

comment 1d ago · link · parent

I've seen a lot of discussion here about the recent Lean proofs, and a general sentiment that formal proofs are something like "compilation artifacts" that aren't meant for human consumption.

I don't think that's right. These languages were designed to be read and understood by humans, and it's only very recently that we've started outsourcing proof construction to LLMs.

The 1Lab is a good example of a large formalization project done in a human-centric way, where the formal code itself helps build understanding of the subject. It's written in a fork of Agda as a literate, cross-linked reference for homotopy type theory and category theory.

3.

1Lab: A formalised, explorable online resource for homotopy type theory(1lab.dev ↗)

1 points · by solomonb · 1d ago · 1 comment

comment 1d ago · link · parent

Regardless of how effective tactics are at making proofs read like traditional ones, I still disagree with your original point that Lean code is analogous to a compilation artifact that one does not try to understand.

It is intended to be written and understood by humans, and it's only very recently that we've started outsourcing that work to LLMs. The new thing here is the size and scope achieved via LLM code gen.

For a large, human-centric formalization project (in a fork of Agda), check out the 1lab: https://1lab.dev

comment 1d ago · link · parent

This isn't true. Lean is an extremely high level language and using tactics you can even get your proofs to look almost identical to handwritten proofs.

comment 1d ago · link · parent

yes but classical axioms are postulated and not computable.

comment 1d ago · link · parent

Sure but if you are going to formalize the proof in Lean then all this applies.

comment 1d ago · link · parent

That is correct classically but not under intuitionism where a proof of "there exists an x" must give a specific x.

comment 1d ago · link · parent

yes but classical axioms are postulated and not computable.

comment 1d ago · link · parent

Lean is built on intuitionistic logic.

I guess you could say an intuitionistic proof of ¬¬(P=NP) is a classical proof of P=NP, but as you said it doesn't get you the algorithm.

comment 1d ago · link · parent

Sort of.. intuitionistic logic is weird. In it, a statement is true when you have a proof of it and a proof is a construction.

A proof of X is some actual construction and a proof of ¬(X) is a function that accepts a proof of X and turns it into a contradiction.

A proof of ¬¬(X) is thus a function that accepts a proof of ¬(X) and turns it into a contradiction. It doesn't actually give you a proof of X.

In the case of P=NP, a proof would be an actual SAT algorithm plus its polynomial bound (and some kind of evidence the SAT algorithm meets the bound).

What you actually hold when you've proved ¬¬(P=NP) is a function whose input is a refutation of P=NP and whose output is ⊥. You can't actually get a proof of P=NP from that.

What you have shown is that any attempt to refute P=NP is doomed but you haven't actually proven it to be true. I know its weird...

comment 1d ago · link · parent

The anti superintelligence view is merely maintaining the status quo, which for all of human history has been that humans are the most capable agents on the planet.

Keeping it that way doesn't require a self-appointed NGO to decide anything. It's the default. The ones making a unilateral decision for "us" are the labs trying to change it.

comment 4d ago · link · parent

The core idea is that you can map the types and terms of a type theory to the propositions and proofs of a formal logic

Different type theories correspond to different systems of formal logic with different levels of power and expression.

Simply Typed Lambda Calculus corresponds to intuitionistic propositional logic. If you lay out the typing judgements of STLC in natural deduction style and then physically erase the terms (leaving the types) then you literally have the rules of intuitionistic propositional logic.

So if you can write a term that typechecks at a type, that term is a proof of the corresponding proposition.

The easiest example is modus ponens, which is exactly the typing rule for function application:

  G |- M : A -> B     G |- N : A
  -------------------------------- (App)
            G |- M N : B
"Given a function from A to B and a value of A, you get a value of B."

So then in a proof checker you prove the proposition P => (P => Q) => Q by writing a program of that type:

  apply :: a -> (a -> b) -> b
  apply x f = f x
`apply` is demonstrated in haskell which does not have a rich enough type theory to give you more then an intuition (no pun intended) for how this all works. Things like `undefined` and general recursion let you "prove" any type, so it isn't a consistent logic. Languages like Lean and Agda are built on richer dependent type theories that give you far more expressive power for writing proofs (quantifiers, induction, etc.), and they won't let you cheat the type theory.

So to answer your question, no not a merkle tree but a tree none-the-less. You end up with a literal computer program which is a tree of expressions all of which must type check. If they type check then program itself is a proof for whatever proposition is encoded in the type of the program.

comment 1w ago · link · parent

Anyone else really put off by the video? Its giving de-skill and discourage effort.

comment 1w ago · link · parent

I did not write the type class declarations in this file but they are generic representation for type classes I did write.

I picked an extreme example. Sadly I don't have a great example of more "business" style code in a public repo to show you right now, but I have had a lot of success using LLMs to write CRUDy haskell APIs and such as well.

I think LLM output quality is wildly dependent on how we prompt them. And I don't just mean giving a really specific design for it to implement or whatever. I have no real proof but suspect that every little thing about how we communicate to an LLM will impact the quality of the output. Like even just our choice of language in how we describe a problem.

I have a friend who is not remotely a programmer who tried to vibe code a big python project with Claude. He came up with really detailed designs and worked through them over and over with Claude. He hit some major roadblocks and asked me to look over the code. I was really shocked at the quality of the code out.

There was tons and tons of dead code, unnecessary repeated expensive computations, no real sense of an architecture, etc. I didn't even re-write it by hand, I just asked claude things like "decompose all the functions to a reasonable size", "use modules to organize the code", "remove dead code", "write pure functions", "parse dont validate", etc. It eliminated thousands of lines of crap, became way easier to read, and improved the speed of the program by orders of magnitude.

comment 1w ago · link · parent

> LLMs are terrible at Haskell type design, but they're terrible at Rust type design too, terrible at deciding when and how to use Python classes, terrible at deciding when metaprogramming is appropriate, terrible at deciding what is well factored and what is not - great scripters, terrible lead engineers.

I find there are shibboleths you can say which get the LLM into a space where it can do better but generally I agree with you.

I also find that if the LLM is working in an existing code base with a really opinionated and consistently applied design that it will largely stay consistent with the codebase. Quality will drift as the ratio of human to LLM code changes so you periodically have to do a big cleanup to keep it from going too far.

comment 1w ago · link · parent

I don't know how to answer this. I find that the quality of claude's output in any language is highly dependent on your skill at prompting it and what context you can provide. Sometimes I might give it type signatures and heavily micromanage it but other times not. I almost always ask claude to develop a plan and architecture which I review before having it produce code.

Here is an example where I literally just told claude I wanted generic instances for these type classes and we had a brief back and forth about the approach then it one shotted this entire module: https://github.com/solomon-b/monoidal-functors/blob/main/src...

I would say this code is indistinguishable from generics code written by a human. However, this type of code has a tendency to only be writable one way.

comment 1w ago · link · parent

I write Haskell every day, both for work and in my free time. Without commenting on the general quality of LLM generated code, my experience is that Haskell is at least as good as any other language for LLM code gen.

19.

Show HN: Dogfood Bench(solomon-b.github.io ↗)

2 points · by solomonb · 1w ago · discuss

comment 2w ago · link · parent

I'm interested in what you are doing with Poly. Can you share more?

I'm pretty fascinated by Poly and have done some work a while back on a poly type theory (amongst other poly projects).

comment 3w ago · link · parent

> But dependent types (and static types in general) don't exist at runtime!

That isn't entirely true when it comes to dependent types and can be seen as a design choice. Types can depend on values and those values can often exist at runtime. Erasure only applies to parts we can determine are not computationally relevant.

For example `Vec n a`. The `n` is a natural number you may need at runtime, such as to get the length without walking the list. A dependent pair `Sigma(n : Nat). Vec n a` carries that `n` at runtime as ordinary data.

In fact many dependently typed languages have techniques, such as quantitative type theory, to assert what is needed at runtime.

comment 4w ago · link · parent

We didn't know what investigations were going to lead to RSA or Diffie-Hellman and any particular breakthrough is standing on a mountain of prior work that didn't have an obvious application but nonetheless was necessary to get to a breakthrough.

Honestly I can't believe I even need to state this. Its literally how science works..

comment 4w ago · link · parent

This is such a short sighted take. Number theory was considered beautifully useless for centuries, and now it’s the backbone of the cryptography that secures every bank transaction. We don't know where the pursuit of knowledge will take us.

Thinking in such a utilitarian way feels like a flavor of Meditations on Moloch.[1] Just look at how short-term, quarter-to-quarter thinking is affecting the economy and the lived experience of every human on earth. It’s horrible.

[1] https://slatestarcodex.com/2014/07/30/meditations-on-moloch/

comment 1mo ago · link · parent

> We should evaluate research by the research itself

Why is this the argument when someone challenges your source, but when it comes to someone else's source your argument is:

> This is research from a labor advocacy group, with the explicit aim of the organization to advocate for this sort of thing. This doesn't mean the research is is automatically invalid, but it is bias worth mentioning.

comment 1mo ago · link · parent

Its pretty clear that there are significant limitations on who has access to the compute needed to drive LLM based scientific research.

comment 1mo ago · link · parent

I think Spaceship Earth goes a bit further back: https://en.wikipedia.org/wiki/Spaceship_Earth

comment 1mo ago · link · parent

what is a 'lo-fi site'?

comment 1mo ago · link · parent

I made a project for this earlier this year: https://github.com/solomon-b/friendly-ghost/

You can can read from Loki or Journald and use regex or alert levels to filter what you pass to the LLM.

I've been using it with deepseek for my homelab. Its pretty helpful.

12345
18