Prompts for A Postscript to Curious OCaml: OxCaml, Rust and Lean
The human-side prompts that developed and steered the draft, in conversation order. Assistant responses, button replies, and interface metadata are omitted, except where a line in italics says what a short answer was answering.
The seed, 28 November
What do you think of the book? I’m thinking we could write an essay for our blog ~/lukstafi.github.io/notes/ to celebrate the release of this new edition.
Claude proposed an essay about how the third edition passed every test while losing three fifths of the book.
Different angle
For the blog essay, I’d like it to partially be a postscript to the book, introducing OxCaml and discussing what makes OCaml and OxCaml good programming languages for humans and AIs. Also compare them to Lean as a programming language and to Rust. What are the pros and cons of each relative to the others? Is OxCaml just plain better than Rust? Is Lean just plain better by allowing better feedback for AIs via on-the-go formalization?
Asked whether the essay should be prepared in its own session in the blog repository:
New session
During the research
Also, look at existing essays for opportunities to link back.
Answers to the outline’s questions
The outline ended with eight questions: his own experience with these languages and where his doubt about proofs stood; how personal the essay should be; how much of the making of the edition belongs in it; one essay or two; whether the size of a language’s training corpus counts, given his earlier rule that what social whim conditions is out; whether the essay should say what he will do next; the frame and the title; and which experiments to run.
Q1: my reservation is around building code that’s verified from the start, but exploring running code and updating it with specifications that are insights into the problem, makes sense. I haven’t run any of these myself since; but we wrote an article about Lean for the blog with GPT Astra. Q2: personal is ok. Q3: I would not really make it about the 3rd -> 4th edition update story, more about the book as a whole. But section 2 already reads this way, so ok. Q4: one essay in two parts that could land as separate posts on Substack if I decide they’re long and good standalone value. Q5: training corpus quality integrated over size. Q6: I would skip this. Also skip Bend, for brevity. Q7: leaning toward title (1).
After the experiments
For “What the essay shows”, can we extend (5) to be less impartial toward the agents? Does the way types structure thinking apply to agents?
Asked whether to run a small experiment comparing agents told to write types first with agents given no method:
Run it
You don’t mention @notes/dependent-types-from-rocq-to-lean.md , it’s worth linking to.
Could we re-run a branch of the experiment in a language without neat variant types / pattern matching? E.g. Python or even TypeScript.
Asked whether to draft the first part or both:
Draft both parts
Reading the draft, 29 November
Let’s start by adding a link to
https://lukstafi.github.io/curious-ocaml/new_book.html . I wonder if
lexical lightness is a contributor to my reaction toward Rust? E.g.
Rust’s std::io::Result<Vec<String>> in OCaml
lexis string vec Std.Io.result
Asked whether to add a short passage on lexical weight to the essay:
Yes, draft it
Asked whether the OxCaml local stream reads as bloated, the way Rust did:
Your question makes me notice: could we maybe add more source code snippets to the essay, in particular in the other three languages we advertise?
Right, in all four languages, OCaml also doesn’t have many snippets.
The local stream reads fine to me, less bloated. What Rust inherits from C++ to some degree is distinctions that matter for the execution / computational semantics, but not to the program meaning / “conceptual semantics”. But the two get intertwined by RAII.
“the reader is on loan” is seldom essential to the “business logic” of what the function computes.
Maybe it’s a point about defaults, and OxCaml has better defaults,
and yet better defaults could be possible if local ,
global etc. would be inferred?
While I keep reading, let’s change the title to “A Postscript to Curious OCaml: Other Languages” or similar, WDYT?
Asked whether to keep the title naming the three languages:
Keep it
WDYT about https://github.com/ocaml/RFCs and https://github.com/ocaml/RFCs/pulls ?
Asked whether to add two sentences on the dormant unboxed-types
proposal and the pace of include functor:
Leave the essay
“What I have wanted from OCaml since 2003 is something else: metaprogramming that knows the types” This conflates two things. And maybe double-check whether it doesn’t conflate three things. One thing is Meta OCaml, which is compiling code at runtime and in which I was interested in the context of genetic programming originally. The need that’s relevant for OCANNL is a preprocessor for writing DSLs: OCaml’s preprocessor runs before typing. The third thing is macros: code that runs at compile time.
Jane Street has research on macros. You might want to check what’s up with that.
Asked whether to fix the same conflation in the published memoir:
Leave the memoir
What’s a distinctive use case for macros in this sense?
nit: “What I have wanted from OCaml is something else, and it is three things.” is somewhat inaccurate. Ideas for fixing the transition?
Drop the wanting, let’s optimize for topic transition smoothness. (The previous short paragraph is already marking that the no-runtime part is not my need.)
Last thing in part 1, “Is OxCaml simply better than Rust?” could be read as slightly adversarial to OCaml community, kind of blaming it for being small and moving slowly… WDYT? Maybe for balance we could touch on language design things like total expressivity / span of features and feature orthogonality?
“There is a small version of the same trap in the tool.” Which trap is it?
This is still unclear: “The essay on dependent types said that this command”answers the dependency question”, and the experiment met the reason.”
Maybe we could showcase one of our Lean proofs. It would complement the previous Lean article.
The ceiling is only hard for Substack posts. What’s the word count of the two parts?
“each split follows one of its tests” – what does it mean? Where do the cases come from?
This paragraph reads well but overclaims: “What do I need, then, as the one who reads?” – “an interface file and a suite of laws” is too optimistic. Similar reason as my reservation: it’s hard to capture a full intended meaning as something significantly more compact than the program itself. The laws, just like tests, can make meaning more accessible while not necessarily more compact. WDYT?
What happens when you add laws that track performance guarantees?
I don’t think the saving disappears because the guarantees can be graded, can be a more- or less-precise envelope of a particular algorithm. The proof itself is not the part exposed, so maybe a bit of caution when we mention it to not be misleading.
Looks good overall. Please do a final editorial pass. Thank you!
I’d also like you to add the study sidecars post to this essay and to the earlier Lean explainer article. And also add new concepts and their connections. You can commit now and then again later or just later, up to you. Thank you!
Asked whether to push main and publish the essay and the study pages:
Push now
Asked whether to remove the Draft tag from the index entry:
Yes, remove it
Add the Substack dates and schedule for Substack, with a gap in schedule for the two remaining drafts. (Worst case I’ll post them in a few days without a thorough review…)
Note the two-part-Substack convention
Any other essay that could be added or moved to the new track?
Do you think of the quality of The Ledger of Mistakes? Hesitant about adding it to the study guide. What would remain in “Which intelligence” after the moves? I forgot that the tensor shapes have their own track, they don’t have study sidecars.
Asked whether to move What Must Be True? and What Should a Program Inherit? into the new track:
Yes, move them
What track is Before the Search Settles in?
And Presumed Normal?
Asked whether to move Presumed Normal too:
Leave it
A big island of concepts hangs only on “preconditions and postconditions”. Can you explore a couple more potential connections with the mainland?