The Can Opener Principle

Context: What’s that? I have a paper deadline in 28 hours? Why don’t I write about literally anything else!

Epistemic Status: It’s a normative theory.

A thing I think about a lot because my brain is completely normal and as a result I spend a lot of time thinking about completely normal things is the role of consent in the ethics of explanation.

The following is a line from the Hypothesis code of conduct:

It’s OK not to want to know something. If you think someone’s question is fundamentally flawed, you should still ask permission before explaining what they should actually be asking.

The Hypothesis Code of Conduct

This is a response to The XY Problem, which is a legitimate problem but often used as an excuse for explaining to someone why their question is bad and they should feel bad. I do think there are cases where non-consensual explanation may be ethically justified, or even mandatory, but they are generally things of the form “You are causing harm by your ignorance and I need you to understand this”.

That’s not to say that in normal interactions you need to bend over backwards to make sure that people are consenting to every word you say to them, but it’s worth checking in with someone before you launch into a significant attempt to educate them.

A thing I realised recently is that it’s not just consent that’s important, it’s informed consent. If you are explaining things to someone, then hopefully you understand it better than they do, which means that you have a burden of responsibility to help guard against infohazards.

This was prompted by a conversation in which a friend who had previously mostly written Ruby was asking me about Python’s class system. We got a while down the rabbit hole before I realised how bad this was going to get and said the following:

I am happy to give you as much information on this subject as you want me to, but my considered advice is that my life has not been made better by the fact that I understand this and neither will yours be.

I think the following is a nice framing of this sort of interaction:

Do not hand a can opener to someone until you are sure that they understand that the can they are holding is full of worms

It’s explanation as gentle knowledge editing rather than explanation as gate keeping: If they do understand that they’re holding a can of worms (maybe it’s for their garden?), handing them the can opener is fine, but as the current holder of the can opener it is your responsibility to make sure they know what they’re letting themselves in for.

This entry was posted in Uncategorized on by .

Research Is A Lot Like Sex

Context: Facetious response to John Regehr’s generally excellent “Why Research Isn’t Like Sex“. I agree with all of the actual advice in that article, but I have a paper deadline tomorrow so I would literally rather do anything but work on the paper and my sense of humour is in a weird place.

Attention Conservation Notice: Surprisingly SFW.

Nobody really agrees on the definition, but they’ve got really strong opinions about what counts, and on what the right way to do it is.

You probably shouldn’t take the version of it you see on TV too seriously.

Nobody is good at it the first time.

It’s usually a bad sign when someone tells you they’re great at it.

When it’s going well it’s amazing, when it’s going badly it’s awful.

It’s a collaborative activity, and works much better with a good partner.

The best bits are spontaneous, but it takes a lot of work and cooperation to get to that point.

Not everybody is into it and that’s OK.

Those who are into it are into all sorts of different types anyway, and do it in a huge variety of different ways.

It’s very important that you get consent from all the participants.

Most of us worry that everybody else is doing a lot more of it than we are.

Sometimes it’s useful, but that’s mostly not why we do it. Either way, it’s a bad sign if you’re not having fun.

If the people you’re doing it with are laughing, you’ve either done something very wrong or very right.

This entry was posted in Uncategorized on by .

Quieting your Dell XPS 13’s Loud Fan

I’ve just replaced my old Dell XPS 13 with a new Dell XPS 13. I’ve never been 100% happy with the Dell XPS 13, but it’s always been a case of “Mostly very happy indeed but…”, and I decided that I didn’t want to think about the type of new computer and get used to a new set of quirks, so I decided to just go for the four year newer version rather than think about it.

I spent the first two days very very unhappy with this decision, because my computer was constantly running hot and sounding like it was trying to achieve liftoff. This was particularly pronounced when I was playing games but it also happened under such high-stress activities as “opening chrome”. I tried using Dell’s power manager (yes I’m running Windows. Most actual work happens in the Linux subsystem, but I have reluctantly concluded that I actually like Windows) to put it in quiet mode and the result was, well, less loud but also much hotter.

Anyway it turns out there’s an easy solution.

The source of the problem is that the new Dell XPS 13 has a very high res but small screen. This results in Windows’s default configuration being high res but scaled up by 300%. Unfortunately the Dell XPS 13 also has a very low end graphics card (I’m not sure if this is actually the source of the problem but I suspect it to be). This makes everything do much more work than it needs to, which is why you’re getting the heat and noise.

In order to fix this, go to the “Change the resolution of your display” system settings (if you press windows key and type “resolution” this should come up as top hit). There you will see “Scale and Layout” set to something like 300% and resolution probably set to “3840 x 2160 (Recommended)”. Change scale to 100% and resolution to one that you feel comfortable reading the screen at (mine is 1920 x 1080). Windows will moan at you about this not being recommended. Do it anyway.

Once you have done this, you should almost immediately hear your fan spin down to nothing. I’ve had no fan noise or heat problems since doing it.

PS. Thanks to David Stark for previously having shared his woes with Windows’s scaling with me, which is what allowed me to diagnose this problem so quickly. Also he has a game out today, Airships: Conquer the Skies, so if thanks to his indirect advice you are now able to play games again without your computer becoming hotter than the sun, why not celebrate with some steampunk aerial violence?

This entry was posted in Uncategorized on by .

D&D Characters I Have Known And Loved

This tweet made me nostalgic for some of my old D&D characters:

I still have fond memories of many of them, and of the reactions they got from both the D&D and many of the other characters.

I’ve been meaning to do this for a while, so I decided that I might as well let “at some point” be now. Sadly many of the details are now lost to time and memory, but here are the highlights that I remember.

I think my absolute favourite was Nicky. Nicky was a sorcerer. You could tell he was a sorcerer because he had a big floppy pointed hat and a magic wand with a big star on the end. He was 10 years old, but had come into rather a lot of power rather earlier than expected as the result of some sort of ancestral power inheritance ritual and a premature death in the family. He had been fobbed off on a long-suffering cleric family friend who basically acted as companion/baby sitter. He really wanted to go adventuring, and the pair of them were in turn fobbed off on the party by some local high ranking NPCs.

We were working on a spell points system in that campaign, and it was quite high level, so Nicky was able to be quite free with his use of magic. Mostly he only used two spells though: Fly and Polymorph Other. Sometimes when he was feeling versatile he used telekinesis.

If you are currently imagining me playing a hyperactive ten year old with more or less unlimited use of those spells, that look of absolute horror on your face is exactly the correct response. This was so much fun to play.

Nicky’s signature combat move was to stay well above the fighting, look for likely looking enemies, and shout “FROGGY. You’re a FROG!” at them. Often this would then turn out to be the case.

My absolute favourite Nicky moment was the following exchange. The party had been sent to help out some wizard. We met him at his front door. Specifically, Nicky insisted on being the one to knock.

The exchange went as following:

Nicky: Hi! I’m Nicky! I’m a sorcerer!

GM in condescending adult-talking-to-children voice: Why hello there. I’m <wizard name>. I’m not a sorcerer. I’m a wizard. Do you know the difference?

Nicky: Yes, you need to read books! That’s boring and silly! I just get to cast spells. It’s much more fun.

GM: Oh yes, and what spells do you know?

Nicky, smiling mischievously: Well… there is one spell I know.

At this point, a dawning look of horror crosses the face of the entire party, and the GM is trying hard not to crack up.

GM: Go on then, show me.

Nicky: *waves magic wand* FROGGY! YOU’RE A FROG!

GM: *critical fails saving throw*. The wizard turns into a frog. He hops around in a very annoyed manner.

Eventually the party persuaded Nicky to turn the Wizard back into a human. This proved to be a mistake as he turned out to be the villain of the story and was much harder to turn into a frog the second time around.

Nicky disappeared off into parts unknown when I had to leave the group due to disappearing off into parts London. Unfortunately they were at the time in an entirely different plane, and Nicky didn’t know planeshift. I hope he’s OK.

Sokor was another fun character. He had three major features of note:

  1. He was a wizard with a rather unconventional approach. He used a lot of force bubbles, teleport spells, and high explosives kept in a bag of holding.
  2. He was actually a pretty decent person, but coded supervillain in a massive way. Among other things he had a fairly diabolical laugh and a companion named Lacky.
  3. Sokor was a small green squirrel, due to a prior unfortunate run-in with an overpowered NPC who cursed him (i.e. because I thought it would be funny).

Sokor was from the same campaign as Nicky, but they didn’t get along due to Nicky “helpfully” trying to turn him back into a human and it not going so well. This allowed me to swap the two characters in and out as I felt like.

Eventually after some adventuring lead to us finding a really nice dungeon Sokor decided to turn it into his new lair. Also at some point he started a burger emporium – it had been a running joke that the only meat available in the local area was chicken, and Sokor spotted a business opportunity that could easily be solved with high level magic…

Sokor was separated from the party when they went dimension hopping.

One of the first characters I played as with this group was Gherran. Gherran was a wandering elven mage who the party happened across and in the usual D&D way went “OK I guess we’re BFFs now”.

NB this was a lie. Gherran was neither elvish nor a mage. He was a fallen (he preferred “tripped”) celestial with a weird and wonderful assortment of powers. His spell set was actually divine in nature, but between a suitable choice of spells and his native abilities he kept the party in the dark about this for a good six months. Eventually he was outed by an NPC, at which point an awful lot of discrepancies in my character build and options suddenly became clear to the other characters.

Gherran was overpowered as hell. The most significant of his overpowered nature was his alternate form which could pass through walls and throw bolts of energy at will (he could only assume this form a limited number of times per day). I also really enjoyed his ability to alter his appearance at will.

Unfortunately despite being overpowered he was also quite fragile. He decided to solo a demon he 100% should not have, and ended up being lost to the party. Due to his celestial nature, no rez was available. He then ended up in the wrong afterlife and things went rather downhill from there.

Marek was the character I played after Gherran. He found the party when looking for Gherran (who he knew as “the coffee maker”. I don’t really remember the story behind that).

Marek was a psion with a level dip in monk. Personality wise he was actually pretty boring, but his speciality in creation was super game breaking. He could basically create arbitrary mundane objects. This frequently lead to him doing things like building bridges over complex traps and puzzles the GM had put in our way.

He also had a bag of holding and a decanter of endless water with a “hot water” mode, so among his more mundane utilities he was able to provide hot baths for everyone who wanted them while on the campaign trail.

All of this meant that his actual combat abilities were merely OK. He wasn’t awful, but he was almost as fragile as a wizard and without the level of heavy hitting required to make up for that. Towards the end of that campaign the party were caught in a full scale battle.

Marek looked around, rated his survival odds and

Rocket Sweden GIF

Marek cast planeshift. He was never heard from again.

Those are all the most notable examples, but there were a number of characters who didn’t last as long who I still have a fond memory for.

  • There was a paladin character who was a surprising amount of fun. I decided that just because he cared about truth and justice didn’t mean he couldn’t be extremely scathing. He was constantly sarcastic and very good at dismissive putdowns of people who didn’t live up to his standards, which was most people. He also rode a griffin and wielded javelins of lightning, which was a delightful combination in combat.
  • There was the plot-critical time travelling heir to the throne. He was a fairly generic warrior build, with a specialisation in duelling and some weird trait that gave him advantages if he had something in his offhand and wasn’t too specific about what that something had to be. It was often a drink. He was irresponsible, constantly drunk, and frequently got bored and wandered off in source of a drink and/or fight. During a Very Important Meeting in which plot that was directly relevant to him was happening he decided to go try and teach the bartender how to make cocktails from his era. “Unfortunately” because he was actually very important the party ended up constantly scrabbling after him trying to keep him alive. Fortunately despite all this he was actually very effective in combat, so that wasn’t as difficult as it sounded.
  • I played a bard based on the observation that intimidate is a Charisma based skill. His specialities other than that was illusion, which due to a feat he could combine with his bardic music. Basically his only role in combat was to control the battle field with illusions that would freak the enemy out while bolstering the party’s morale. One particularly memorable fight involved him playing his fiddle to “summon” an army of dancing skeletons. Another notable scene was 100% my best ever in-character full-on rage at another PC (out of character I wasn’t too annoyed. It was pretty much in his normal range and it was funny, but there was no way my character would have let is slide). Sadly I flubbed the intimidate roll on that, even after spending an action point to reroll it, so it didn’t actually work out that well in game.

I also played a few other less notable characters. There was the tiefling warlock who never really got around to betraying the party, the other bard whose only notable achievement was a rather inappropriate deployment of a “Feather Token: Oak” on a floating city (I don’t really remember why or now it went, but that was the very first character I played with that group and it probably gave them a taste of what they were in for), and I think a few others from one-offs that were even less memorable.

Sadly I moved away from that D&D group. I’ve made a few attempts to start up again since, but it’s never really gone anywhere. It’s a fairly large time commitment, especially for the GM.

This entry was posted in Uncategorized on by .

Test-Case Selection and Choice Theory

Attention conservation notice: Honestly you probably don’t care about this post unless the title sounds really intriguing to you. I’m not sure this matters at all.

At its most abstract, the test case selection problem is a function \(T : \mathcal{P}(A) \setminus \{\emptyset\} \to A\) such that \(T(U) \in U\). i.e. we have some set \(A\) of possible test cases, a bug that occurs in some non-empty subset of the test cases, and we want to select a test case to represent the bug. Call such a \(T\) a choice function.

(The axiom of choice states that choice functions always exist, but our sets of test cases are actually always finite, so we don’t need that here).

This elides some complexity in that:

  1. Our test case selection may be non-deterministic. In this case we can (by fixing the set of random choices made) treat this as a choice-function valued random variable, so it still reduces to this.
  2. The test-case selection might fail. We can ignore this problem by assuming that it will succeed eventually (assuming it doesn’t do something silly) and just running it until it does. For some methods this may take rather a long time and we might have to worry about implementation details like the heat death of the universe, but ¯\_(ツ)_/¯

This is actually a coincidence of naming for the most part, but choice functions are interestingly related to choice theory: The problem of expressing a preference between alternatives, and describing axioms of “rationality” for doing so.

One interesting axiom of rationality is that of contraction consistency. Contraction consistency is the requirement that if \(T(A) \in B \subseteq A\) then \(T(B) = T(A)\). i.e. if you picked \(T(A)\) as the best element of \(A\), removing elements from \(A\) that aren’t \(T(A)\) shouldn’t change your opinion!

On the face of it this seems reasonable, but it actually imposes a very strong restriction on what \(T\) can look like.

Theorem: If \(T\) is contraction consistent then \(T(A) = \min\limits_\prec A\) for some total order \(\prec\).


Define \(a \prec b\) if \(a = T(\{a, b\})\). This is antisymmetric because the set \(\{a, b\}\) doesn’t depend on the order of \(a\) and \(b\), and reflexive because \((T(\{a\}) = \in \{a\}\), and total because \(T(\{a, b\} \in \{a, b\}\) so either \(a \prec b\) or \(b \prec a\).

So to show that it’s a total order we now need to show that it’s transitive. Suppose \(a \prec b\) and \(b \prec c\). Then \(T(\{a, b, c\}) = a\): If it were \(c\) then this would violate contraction consistency when considering \(\{b, c\}\), and if it were \(b\) then it would violate it when considering \(\{a, b\}\). Now, by constraction consistency, \(T(\{a, c\}) = T(\{a, b, c\}) = a\), so \(a \prec c\).

Now suppose \(b \in A\). By constraction consistency, \(T(\{T(A), b\}) = T(A)\). Therefore \(T(A) \prec b\), and so \(T(A) = \min\limits_\prec A\) as desired.


What this means in practice is that the only contraction consistent test-case selection methods must be equivalent to bounded exhaustive enumeration: You have some total ordering over your test cases, and in order to return a test case \(a \in A\) you must have verified that \(b \not\in A\) for every \(b \prec a\). This is potentially very expensive if all you have is membership queries for \(A\)! If you have more structure on \(A\) (e.g. because of symbolic execution) then you could potentially rule out this happening without actually performing those membership queries.

If you adopt the classic approach of generating a random test case then running test-case reduction on it, you will typically require substantially fewer membership queries for the set, but the \(\prec\) relationship in the above proof may not even be transitive!

Say, for example, that we have \(A = \mathbb{N}\), and our test case reduction algorithm consists of iterating the operations \(n \to n / 2\) and \(n \to n – 1\) to a fixed point as long as they remain in the set. So for example if we have \(A\) as the set of even numbers and start from \(8\) then we will go \(8 \to 4 \to 2\), having tried \(7, 3, 1\) and concluded they weren’t in the set. If we’d started from \(10\) though we’ve have become stuck because both \(10 – 1\) and \(10 / 2\) are odd. This is then an example of intransitivity, because we have \(5 \prec 10\), and \(4 \prec 5\), but \(4 \not\prec 10\), and this intransitivity is in large part responsible for our failure to find a global minimum.

(Note that it would be perfectly possible to have \(\prec\) be transitive and have \(T\) not be contraction-consistent – just make \(T\) do something different whenever \(|A| > 3\). Contraction consistency implies the transitivity of \(\prec\), but we still needed the full consistency to show that \(T(A)\) was the \(\prec\)-minimum).

This is roughly equivalent to the observation that classic choice theory only really works for logically omniscient agents: Test-case reduction is actually a boundedly rational agent that is unable (or unwilling) to run exponential time algorithms, while a logically omniscient agent is perfectly happy to do that and considers it a free action.

There is also an interesting topological perspective that allows us to firm up what we mean by \(T\) being “black box”, but I think I’ll leave that for another time.

This entry was posted in Numbers are hard, programming on by .