Wednesday, December 03, 2008

Westminster 1.4; the developer's guide

Those crazy Canadians, eh? It looks like they're about to do that rare thing in a Westminster-type constitution, throw out the government on a confidence vote and substitute another. Not just that, they're going to do that even more rare thing in a Westminster-type constitution, form a multi-party coalition. Not just that, they're going to have a German-style toleration agreement with a party that isn't in the government. Woo. It also looks like the Canadian prime minister is trying to do something weird to the constitution to save himself, and there is a chance of a good crisis.

So why don't we have a look at how this rarely-used function works? It's not just Canada, after all - Anthony "Nate Silver before there was Nate Silver" Wells' swing projection currently shows the next election ending in a hung parliament, with the Tories 26 seats short of a majority. And there's also some interesting TYR research related to that. I was saying in one of Wellsy's threads that the polls almost seemed to make up two distinct series - one which showed the Tories with a steady lead north of 10 points, one which was much lower.

So I got the data for the last three months, split the polls into two groups, one with Tory leads of 10% or above and one with the lower ones. First observation - in the last couple of months they've practically alternated. Second, the lower ones show a marked downwards trend. I graphed them against a common timeline, drew trendlines, and computed the R-squared values. Here's the chart.


The high delta-cee series has raging volatility, but no trend. But the low delta-cee ones are marching steadily downwards with R2 = 0.77. Clearly, the variance in the polls is widening sharply, but it's only happening on one side - the bounds of the probable take in more and more chances of Tory failure. So, sitting back in Whitehall and reading this, what file would you ask to see? Surely the one on "Change of Government".

Unfortunately, although the system provides for elective government with oversight and a legislative development environment, it's not terribly well documented. There is no canonical procedure for an unplanned change of government, or for an inconclusive election - this is left up to the implementer. However, according to Peter Hennessy's The Prime Minister, the procedure used last time, in February 1974, goes like this: the PM stays PM until he resigns or another PM is appointed. This is clearly Pythonic - the variable PrimeMinister is a pointer to an object containing the PM's name, and we can change it at any time. This variable is scoped to the namespace it is declared in, unless explicitly referenced.

But who appoints the PM? I'm indebted to the folk at Making Light for this idea, but it's all down to the distributed head of state protocol. The answer is - depending on your local implementation, the Local Distributed Queenship Node. It's a bit like DNS, but for State authority; there is a root zone DQN, who is an old lady from Windsor, but she is also the LDQN for the UK. Any LDQN can subdelegate part of their zone to another they create. Some entities - like Canadian provinces - look up the root first, but they are routed back to their national LDQN via the constitutional equivalent of a CNAME. Now, the use of the LDQN's powers is subject to the approval of Parliament, so there is a sort of AND gate here.

But it's worth pointing out that the root DQN operator was appointed by an Act of Parliament; it's actually quite like a German elective monarchy, with an unusually long time-to-live value. And the operative word here is "live".

Anyway, the LDQN has the right to set the value of PrimeMinister, but this has to pass a check with the majority of the lower house of parliament. Let's see some code:
while len(parliament.opposition.members) < len(parliament.government.members):
.....if election==False:

When the LDQN catches one of these signals, strange things happen. NEWPARLIAMENT is straightforward; the LDQN sets PrimeMinister to the leader of the majority. But what if there is no majority? Unfortunately this bit is largely undocumented. And what about NOCONFIDENCE?

Well, in practice it works like this. The existing PM gets a crack at forming a coalition, in the case of NEWPARLIAMENT, or talking the rebel MPs around, in the case of NOCONFIDENCE. In the early 90s, John Major's government actually experienced a NOCONF event but succeeded in passing a renewed confidence vote the same night. In this case, there is a need for an explicit confidence vote. If the PM doesn't get this, or can't form a coalition? He or she may try to call ldqn.dissolve_parliament() to trigger new elections, but this will not be granted if there has just been an election. Instead, the behaviour of the root LDQN on the last two occasions this happened was to give the PM a go at forming a government, then set PrimeMinister = LeaderOpposition.

If the leader of the Opposition can't form a government, then a new election would be called. In the code:
if ldqn.audience = NOCONFIDENCE:
...newGovt = (PrimeMinister).formGovt()
...if newGovt == True:
.....if len(parliament.opposition.likely_members) > len(parliament.government.members):
........newGovt = (LeaderOpposition).formGovt()
if ldqn.audience = NEWPARLIAMENT and parliament.overall_majority == True:
...newGovt = (LeaderOpposition).formGovt()
elif ldqn.audience = NEWPARLIAMENT and parliament.overall_majority == False:
...newGovt = (PrimeMinister).formGovt()
...if newGovt == True:
...elif newGovt == False:
.....newGovt = (LeaderOpposition).formGovt()
...if newGovt == True:
...parties = [len(party.members) for party in Parliament.parties]
...newGovt = (leader(max(parties)).formGovt()
...if newGovt == False:

Fuck me, this constitution lark is more complicated than you think, especially when you remember that this whole outlandish signalling cascade isn't specified in primary legislation at all. And frankly, it's clearer in Python than English. Bugs in the process have caused serious trouble in the past, notably in Australia where the LDQN experienced a catastrophic partisanship error in 1975. But then, that's what you expect from code that's in permanent beta.

Worryingly, the Canadian prime minister seems to think he can avoid his fate by having his LDQN, Governor General Michelle Jean, prorogue Parliament. Normally, prorogation automagically triggers dissolution, which further triggers elections. But obviously that's not what he wants; he just wants the squabbling parliamentary rabble to go away. One hopes the civil servants are firm with him; due to the poor specifications, in 1974 we had to rely on them to get it right on the night. (Update: Anyone spot the deliberate mistake?)

1 comment:

Gridlock said...

I use pseudocode to work through various business processes etc - so looks to me like Pyton is a fairly good next step :) - Monarch Aviation - anything to report?

kostenloser Counter