Enforcing the Consequent

Posted on June 8, 2020 by Jack Kelly
Tags: coronavirus, logic

To successfully do anything at all, you must have some idea of how cause and effect works in the world around you. I’m getting very worried by a pattern I’ve noticed, where large organisations are actively disconnecting themselves from reality because they cannot honestly achieve their goals. This cannot work, but it’s worse than that: the now-blind organisations cannot notice it not working, and risk becoming stuck in their delusions.

This phenomenon feels like a special case of Goodhart’s Law (“when a measure becomes a target, it ceases to be a good measure”) crossed with the fallacy of Affirming the Consequent (“All men are mortal. Socrates is mortal. Therefore, all men are Socrates.”). The pattern, which I’m calling enforcing the consequent, looks like this:

Boosting B so aggressively often means turning off feedback mechanisms which would signal that more B is a bad idea. I’m seeing this happen in really large organisations and systems, and that scares me: big systems can make big mistakes. Examples after the jump.

Read more...

Changing the Distance Metric

Posted on May 19, 2020 by Jack Kelly
Tags: coronavirus, maths

Mathematics has this idea of a metric, which generalises the idea of distances that we normally think about. If we take a set X, we can talk about a metric or distance function, which is a function d : X × X → X, that means “the distance between x and y”, and it has to have the following properties for any x, y, z ∈ X:

  1. The distance between x and y is 0 if and only if they are the same thing:
    d(x, y) = 0 ⇔ x = y

  2. Symmetry: The distance between x and y equals the distance between y and x:
    d(x, y) = d(y, x)

  3. Triangle Inequality: If you’re going between x and y, detouring via z cannot be shorter:
    d(x, y) ≤ d(x, z) + d(z, y)

Read more...

What I Remember

Posted on April 26, 2020 by Jack Kelly
Tags: coronavirus

(Note: all Twitter links have screenshots next to them, as it’s notoriously difficult to predict what Twitter shows on the other end of a link.)

Update History:

What do I remember about the coronavirus pandemic?

I remember watching case numbers double and redouble throughout late February and early March, thinking “oh god, we’re only a few doublings behind Italy, and our leaders are going to drop the ball”.

Read more...

The Power of Tiny DSLs

Posted on April 3, 2020 by Jack Kelly
Tags: haskell, coding

I was playing around with codeworld-api recently, and found myself with a pair of interesting problems:

Placing the picture is easy — codeworld-api provides two functions that do exactly what I want:

Going the other way is more difficult. After noodling around on paper trying to compute the inverse transform, I remembered that these transformations could be represented as 3x3 matrices (Wikipedia has some examples), and that inverting a 3x3 matrix is easy (provided that the affine transformation it represents hasn’t collapsed the space).

This means I have to compute the transformation twice: once as codeworld-api calls, and once as matrices. Or do I?

Read more...

nix-freeze-tree

Posted on January 25, 2020 by Jack Kelly
Tags: nix, haskell, coding

I really like using Nix to build and manage my computers. Declarative machine definitions are incredibly powerful, and NixOS actually achieves what tools like Ansible and Chef have tried to reach for.

This web site is served from a NixOS machine, and is a collection of static files which get copied across by nix copy when it sends the built NixOS expression to the server. Until recently, my built website lived in a single derivation, which meant that any time I changed anything, a full rebuild of the site would get sent up my terrible internet connection.

I have written a tool to split up the big derivation called nix-freeze-tree (Hackage). It lets me split the website derivation down to individual files, and symlink them together back into the tree I want. The individual derivations are fixed-output derivations, which means that Nix knows the hash of the files before it builds the derivation, and can check the hash of the files to copy and skip files that haven’t changed.

If you’re reading this, then I’ve successfully wired nix-freeze-tree into my site build pipeline and deployed it.

All Posts | RSS | Atom
Copyright © 2020 Jack Kelly
Site generated by Hakyll (source)