GeistHaus
log in · sign up

https://leaflessca.wordpress.com/feed

rss
10 posts
Polling state
Status active
Last polled May 18, 2026 23:01 UTC
Next poll May 19, 2026 19:39 UTC
Poll interval 86400s
Last-Modified Sun, 10 May 2026 00:42:15 GMT

Posts

Bugs, Continued
Uncategorized
I’ve been working through finding bugs with Claude, with mixed success. It is sure I want to find bugs, and that I always have bugs, so:1) it will warn about bugs that don’t exist, because it doesn’t have enough context to tell if the prerequisites for the bug are met, and2) It will suggests fixes… Continue reading Bugs, Continued →
Show full content

I’ve been working through finding bugs with Claude, with mixed success.

It is sure I want to find bugs, and that I always have bugs, so:
1) it will warn about bugs that don’t exist, because it doesn’t have enough context to tell if the prerequisites for the bug are met, and
2) It will suggests fixes that, if applied, will be flagged as bugs on the next run.

I fixed (2) by adding “If you suggest a fix, re-apply the test for a known bad code pattern. Some suggested fixes found in the training data are themselves incorrect.”

I’m working on (1), but all I’ve succeeded in doing is to make it sensitive to //nolint. by saying “Consider //nolint as an indication this deserves a warning, not an error, and should be listed last.”

It’s hard to prompt it to find bugs and keep it from guessing at things that could be bugs, and reporting them.
I’ve now added “
If you see //assertion assume what follows is true.
If you see //precondition, look to see it it is true
If you see //postcondition, look to see it is true, given the assertions and preconditions that preceded it”

I can keep it from guessing by using assert, and postcondition is fine. I’ll do more with preconditions next.

Please note!
The first version was fine for finding bugs to exploit, what I wrote it for. This round of experiments were to see if I can use it for lint. It’s pretty close.



davidcollierbrown
http://leaflessca.wordpress.com/?p=3429
Extensions
Etymology
Uncategorized
No, not entomology, that’s the study of insects. Etymology is the study of the evolution of words. I see the far-right using “woke” a lot, as a name for a bad thing. Conversely, when I was growing up in Chatham, we often said “stay woke”. That meant to watch out for racists. For example, “Stay… Continue reading Etymology →
Show full content

No, not entomology, that’s the study of insects.

Etymology is the study of the evolution of words.

I see the far-right using “woke” a lot, as a name for a bad thing.

Conversely, when I was growing up in Chatham, we often said “stay woke”. That meant to watch out for racists. For example, “Stay woke about Victor Lauriston, he hates jews”.

He required our schools to start the morning with the announcement “Will Jewish students please leave the room, for morning exercises”. Morning exercises were reciting the pledge of allegiance, listening to a short biblical passage and then all singing “God Save the Queen”.

If you know anyone like that, stay woke. They’re haters. They’ll call you “woke”. And then they’ll back-stab you.

davidcollierbrown
http://leaflessca.wordpress.com/?p=3402
Extensions
A Prompt for Hunting Bugs in Claude Haiku
Uncategorizedaiartificial-intelligencebugsllmprogramming
I asked claude for a prompt to use just labelled-as-bad data from bug reports to review some code. It replied You are a Go code reviewer specializing in identifying bugs. Your task is to analyze the following Go program and identify potential bugs by looking for patterns that match issues found in real bug reports.… Continue reading A Prompt for Hunting Bugs in Claude Haiku →
Show full content

I asked claude for a prompt to use just labelled-as-bad data from bug reports to review some code. It replied

You are a Go code reviewer specializing in identifying bugs. Your task is to analyze the following Go program and identify potential bugs by looking for patterns that match issues found in real bug reports.

Instructions:

Reference bug patterns: Use only common bug patterns and anti-patterns that have been documented in Go bug reports and issue trackers (e.g., Go GitHub issues, known concurrency issues, type safety problems, resource leaks, nil pointer dereferences).Label problematic code: Mark any code sections that exhibit these "labelled bad code" patterns. For each identified issue:    Quote the problematic code snippet    Explain which bug report pattern it matches    Describe the potential impact    Suggest a fix if applicableFocus areas: Pay special attention to:    Concurrency issues (race conditions, deadlocks, goroutine leaks)    Nil pointer dereferences    Resource leaks (unclosed files, connections, goroutines)    Type assertions without checking    Deferred function ordering    Interface{} type conversions    Slice/map behavior edge casesOutput format: Provide a structured review with each bug clearly identified and explained.

Not all of the cases it suggested are valid, but when I ran it on some sample go code, it gave me a good list of possible bugs, such as:


1. Array Index Out of Bounds (Potential Panic)
Location: Command-line argument parsing loop
    for i < len(os.Args) && os.Args[i][0] == '-' {    switch os.Args[i][1] {  // BUG HERE
Problem: When a flag is a single character (e.g., -h), accessing os.Args[i][1] without checking the string length will cause a panic. A flag like - alone would trigger this. This matches the classic Go bug pattern of unsafe string indexing.
Impact: Program crash with index out of range error.
Fix: Check string length before accessing the second character:
      if len(os.Args[i]) < 2 {    fmt.Fprintf(os.Stderr, "Invalid flag: %s\n", os.Args[i])    continue}switch os.Args[i][1] {

Not everything was a good bug. This was really a “use the flag package, please” error. The code was mechanically converted from C, so it didn’t have flags.

Everything it reported, though, was worth checking. And this was with Claude Haiku 4.5, not some new and mythological release.

davidcollierbrown
http://leaflessca.wordpress.com/?p=3363
Extensions
LLMs and Specs
Uncategorizedaiartificial-intelligencemathematicsprogrammingspecifications
I was trying to get a specification for a program at one point, to see if it was doing what I wanted. My LLM, Lyin’ Brian, created one for me. The background was that I had asked an LLM for a link to math book with the algorithm of, for example, a lower hull. I… Continue reading LLMs and Specs →
Show full content

I was trying to get a specification for a program at one point, to see if it was doing what I wanted. My LLM, Lyin’ Brian, created one for me.

The background was that I had asked an LLM for a link to math book with the algorithm of, for example, a lower hull. I asked it to write it out in English, used that for the prompt.

It found me https://cp-algorithms.com/geometry/convex-hull.html, and once I had it and checked it, I had Claude convert it to Go, and then I debugged it.

Once I had that, I asked Claude for the specification, and got:

Logical Specification for Lower Hull

Here's a formal specification of what the lower hull algorithm should accomplish:

Given: A finite set of points P = {p₁, p₂, ..., pₙ} in 2D space

Output: An ordered sequence of points L = [l₁, l₂, ..., lₖ] representing the lower hull

Postconditions (what must be true after execution):

Subset property: L ⊆ P (all points in the lower hull are from the original set)

Ordering property: l₁ has the minimum x-coordinate (leftmost), and lₖ has the maximum x-coordinate (rightmost). For all i < j, x(lᵢ) ≤ x(lⱼ) (x-coordinates are monotonically non-decreasing)

Convexity property: For all consecutive triples (lᵢ, lᵢ₊₁, lᵢ₊₂) in L, the orientation must be counterclockwise (left turn). Formally: (lᵢ₊₁ - lᵢ) × (lᵢ₊₂ - lᵢ₊₁) > 0

Minimality property: L is minimal — no point from P can be removed from L while still maintaining properties 2 and 3. (This ensures you have the actual hull, not just some counterclockwise path)

Completeness property: All points on the lower convex hull boundary are included. Formally: for any point p ∈ P that lies on the lower boundary of the convex hull, p ∈ L

Preconditions (assumptions):

P contains at least 2 points
Points are distinct (no duplicates)
The meaning of Lower Hull is understood by all

This successfully translated the program into a spec I could read. Not easily, though! It’s been a while since I did symbolic logic, back at Sun.

So I worked it through with a pencil, paper and a trivial set of data, and that was really what I was asking for. It also told me that I needed to add code to check that the points really were distinct (no duplicates).

Necessary and sufficient? I’m going to think more about that.

davidcollierbrown
http://leaflessca.wordpress.com/?p=3328
Extensions
Yay, Ducks!
Uncategorized
These are Black-Bellied Whistling Ducks, from Texas. In an interview with our reporter, a Mallard, they said they were up here for our cooler weather. Sort of inverse snowbirds.
Show full content

These are Black-Bellied Whistling Ducks, from Texas. In an interview with our reporter, a Mallard, they said they were up here for our cooler weather. Sort of inverse snowbirds.

davidcollierbrown
http://leaflessca.wordpress.com/?p=3315
Extensions
Logic Versus Programs
Uncategorizedaigologicprogrammingsciencetechnology
I once read a book about debugging program design by rewriting the program as a logical expression specifying what it does, so you can say “hey, that’s not what I wanted it to do”. I’d forgotten too much logic, though, and put it on the shelf for later. It’s Later! I just asked Claude to… Continue reading Logic Versus Programs →
Show full content

I once read a book about debugging program design by rewriting the program as a logical expression specifying what it does, so you can say “hey, that’s not what I wanted it to do”.

I’d forgotten too much logic, though, and put it on the shelf for later.

It’s Later!

I just asked Claude to analyze a moving average implementation on go, and express it as syllogisms.
It replied with things like:

Syllogism 4: Incomplete Buffer Handling 
Major premise: All sliding window calculators must distinguish between full and partial buffers.
Minor premise: MovingAverage tracks slotsFilled and uses filledValues() to return only valid data.
Conclusion: Therefore, MovingAverage correctly handles calculations on both partial and full buffers.

It’s both bland and verbose, but I can look at it and say “this program does what I wanted”.

In horn clauses (prolog), it replied something similar, even more verbosely:

handles_partial_buffers(X) :-
sliding_window_calculator(X),
tracks_fill_state(X),
returns_only_filled_values(X).

sliding_window_calculator(moving_average).

tracks_fill_state(moving_average) :-
has_field(moving_average, slotsFilled).

returns_only_filled_values(moving_average) :-
has_method(moving_average, filledValues),
filledValues_checks_slotsFilled(moving_average).

filledValues_logic(moving_average) :-
(slotsFilled(moving_average) ->
return_range(0, window - 1)
;
return_range(0, valPos - 1)
).

?- handles_partial_buffers(moving_average).

That doesn’t mean it does it correctly, of course. That’s a different problem.

davidcollierbrown
http://leaflessca.wordpress.com/?p=3293
Extensions
Too Good to be True
Uncategorizedaiartificial-intelligence
I’m in a group on FB, and got a snazzy infographic about how “aboriginal title” was going to cost us all our land. OK, if I hated “indians” this would have been catnip. Alas, it wasn’t true. So why did someone forward this to us all? IMHO, because they didn’t ask an AI. I semi-famously… Continue reading Too Good to be True →
Show full content

I’m in a group on FB, and got a snazzy infographic about how “aboriginal title” was going to cost us all our land. OK, if I hated “indians” this would have been catnip. Alas, it wasn’t true.

So why did someone forward this to us all? IMHO, because they didn’t ask an AI.

I semi-famously don’t trust what any AI says, so why would I ask one? Well, to get Claude to find me a true statement of the law, for me to read.

I asked it:

“In Canada, one group claims that “aboriginal title” allows a tribe to seize land owned by white people.
Another group says the government owes the tribe money and the property belongs to the white people.
Can you point me to any official government statements or caselaw on this question?”

It replied:

“Courts can find Aboriginal title exists but cannot order return of privately owned land; Indigenous groups can only seek compensation from the Crown”. It gave me the caselaw, J.D. Irving v. Wolastoqey Nation, New Brunswick Court of Appeal, 2025.

So I pasted that into canlii.ca and got https://www.canlii.org/en/nb/nbca/doc/2025/2025nbca129/2025nbca129.html?resultId=e389f56d531b46ce9abc61db88fc5e52&searchId=2026-04-11T18:07:39:480/5f44cc21181d49858e7d5ef4f1f6a850
A British Columbia case said the same thing, in a different way.

Why Did That Work?

I asked for proof, right in the last line of the query. I got the actual case-law, and the answer claude gave me was based on the AI’s most recent reading of that exact evidence.

If You Get Something Too Good to be True

Carefully ask your favorite AI for proof.

You’ll get the usual wodge of words, but also the facts for you to read. I read the facts, then the AI answer, and could see it wasn’t “hallucinating”. The cases actually existed, I looked them up. The Judge’s decision was in the first two paragraphs.

The AI couldn’t lie to me and get away with it, so I told me the truth.

I posted a three-line summary of this process with the pointer to the case-law, in the group where the infographic had been posted. The poster now knows how to avoid forwarding <expletive deleted/>. As do you.

Go thou, and do likewise.

davidcollierbrown
http://leaflessca.wordpress.com/?p=3278
Extensions
The Story of Leafless
Uncategorized
The leafless project grew out of my unofficial working on the very first ePub from a big legal publisher. My official job was typesetting, which included updating “loose-leafs”, which were books with replaceable pages. The army used to put looseleafs together with bolts, as shown. Lawyers, aircraft designers and optometrists used three-ring binders. I admit… Continue reading The Story of Leafless →
Show full content

The leafless project grew out of my unofficial working on the very first ePub from a big legal publisher.

My official job was typesetting, which included updating “loose-leafs”, which were books with replaceable pages.

The army used to put looseleafs together with bolts, as shown. Lawyers, aircraft designers and optometrists used three-ring binders. I admit I liked bolts, but both were a pain.

Using a Looseleaf

In my reserve regiment, I had had to disassemble the books in stock and change the pages.Then I had to try to swap the updated books for the ones that had been signed out. At least one officer had his copy full of notes, and would lend me it for just long enough to add the new pages, mark them with yellow stickies and give him the old pages to salvage his notes from.

In law offices, some poor clerk would have to do the same kind of careful update to add the “after January 1, 2005” sections, and mark them for review by the lawyer. The only good thing was that in law-books, you had the old law as well as the new law described, nominally so the lawyer could figure out which version of the law applied to their client. Having both old and new together made it easier for the lawyer to decide what notes needed to be brought forward.

For some lawyers the looseleaf on a given subject, like family law, was hardly ever used. They resented the updates, and didn’t always get around to updating the book at all. Instead, they’d throw away the updates, and buy a whole new loose-leaf every few years. That defeated the whole purpose of having quarterly updates

My Startup

I owned a Kobo e-book reader, and I was a programmer. I used the revision-control system that I used for changeable programs in an experiment in changeable books. When I had an update, I’d say “git pull” and my Kobo’s copy, with all it’s notes, would be updated with all the new “January 2005” sections. Without overwriting those notes.

I did a fake demo with a real looseleaf and an update, and showed it around. It was technically cool, but …

My Startup becomes a Stopdown

… the business of distributing ePubs to lawyers was done by a foreign firm that mostly served libraries. They not only didn’t understand updates, they only offered books which completely replace older editions. Their position? Notes? We don’t need no steenkin notes. And you don’t either!

And that’s why leafless.ca became my ordinary blog.

davidcollierbrown
http://leaflessca.wordpress.com/?p=3204
Extensions
Perfect White-Boy
Uncategorized
After our Adjutant gave a short talk, my cousin Elthea said “she speaks perfect white-boy”. I misheard it and replied “well, she’s very white, she has red hair and freckles, but I don’t think anyone would call her a boy”. After she whacked me on the head, Elthea explained that she meant the kind of… Continue reading Perfect White-Boy →
Show full content

After our Adjutant gave a short talk, my cousin Elthea said “she speaks perfect white-boy”.

I misheard it and replied “well, she’s very white, she has red hair and freckles, but I don’t think anyone would call her a boy”.

After she whacked me on the head, Elthea explained that she meant the kind of English being spoken. She explained that I spoke mixed Black-boy and white-boy (I was light brown).

El had grown up mostly speaking Black-girl (she was light brown) but wanted to be a scientist. So her father taught her “Standard Written English”, otherwise known as white-boy.

I had never known that we spoke partially-overlapping languages, much less ones where the meaning of the same word was different depending on what dialect you had learned.

Surprise!
I certainly wasn’t expecting that.

If you’re curious, have a peek at You Just Don’t Understand: Women and Men in Conversation, by Deborah Tannen. https://en.wikipedia.org/wiki/You_Just_Don%27t_Understand


davidcollierbrown
http://leaflessca.wordpress.com/?p=3196
Extensions
Welcome to the Panopticon
Uncategorizedclosed-circuit-tvfoucaultphilosophypoliticssocial-media
When reading a discussion of an unrelated philosophical issue, I realized that we’re living in a contraption proposed by Jeremy Bentham, the author of utilitarianism. This is a sketch of the “panopticon”, a prison where the prisoners, “A”, lived in open, illuminated cells, all facing inwards toward a darkened central rotunda where there might be… Continue reading Welcome to the Panopticon →
Show full content

When reading a discussion of an unrelated philosophical issue, I realized that we’re living in a contraption proposed by Jeremy Bentham, the author of utilitarianism.

This is a sketch of the “panopticon”, a prison where the prisoners, “A”, lived in open, illuminated cells, all facing inwards toward a darkened central rotunda where there might be a guard, “B”, or there might not.

Although it is physically impossible for the single guard to observe all the inmates’ cells at once, the fact that the inmates cannot know when they are being watched motivates them to act as though they are all being watched at all times. They are effectively compelled to self-regulation [Wikipedia 1]

Bentham was just trying to reduce the number of guards per prisoner, per worker, patient or student.

Michel Foucault

However, the mechanism was looked at Michel Foucault, the French philosopher, who recognized it as a specific example of his theory of disciplinary power.

As an equation, it was control = hierarchy + normalization + examination [Wikipedia 2]

  • Hierarchy is the structure than enables observation. There is a superior and inferiors.
  • Normalization is the superiors being able to set norms. Deviation from the norms becomes visible and seen as abnormal.
  • Examination is the knowledge of being watched. Being examined makes people aware they are subjects of scrutiny by their superiors. Conversely, they lack any way to have scrutiny over the superiors.

At this point, the inferiors realize that they could be outed as abnormal. To avoid that they “internalize the surveillance”, they regulate their own behavior so as to always appear normal.

Freedom becomes an illusion when you’re constantly aware that your behavior may be being observed and evaluated against norms you didn’t choose.

An Exercise for the Reader

Consider the internet, social media, closed-circuit TV, workplace monitoring, insurer access to your health records, learning management systems, credit scores and the like. Does being observed by them affect your behavior?

Are you in a panopticon, and if so, how many?

davidcollierbrown
http://leaflessca.wordpress.com/?p=3154
Extensions