Showing posts with label logic. Show all posts
Showing posts with label logic. Show all posts

Friday, September 18, 2015

Mercurial koans

A young acolyte approached Master Hg.  "Master Hg, what is the nature of Mercurial Branches?"

Master Hg replied, "Branches are markers attached to every commit, indelible and eternal."

The acolyte nodded.  "Master, if we use branches for tracking new features in our product, how are we to avoid namespace pollution?"

Master Hg regarded the acolyte coolly.  "Mu.  Branches are lines of development, forgettable and ephemeral."

At once, the acolyte was enlightened.

A student was working under Master Hg.  "Master, yesterday I discovered a seven-headed hydra in our history."

Master Hg nodded, saying nothing.

"I did not wish to fight the beast, but I noticed it resided entirely on a separate branch.  So I closed the branch, and thought it dealt with.  But today I looked again and saw the hydra still lived.  Why was the branch not closed?"

"The branch was indeed closed," replied Master Hg, "leaving six branches open."


Ed. note: This koan is obsolescent and has no successor.

One day, a traveler from a faraway land sought Master Hg's guidance.  "Master Hg, I wish to alter history."

Master Hg nodded, smiling warmly.  "What you seek is easily attainable.  History is supple and easily rewritten."

Excitedly, the traveler began researching in Master Hg's veritable library and shared his work with others.  After many days, he returned.  "Master, when I tried to share my changes with my friends, as I have done in my homeland, the DAG became extremely confused and I had to re-clone the server.  Why does Mercurial not work correctly?"

Anger flashed across Master Hg's face.  "What you seek is impossible.  History is unyielding and changing it the domain of the gods."

"But mere days ago," the traveler protested, "you told me otherwise."

"I find it curious you remember events which did not occur," replied Master Hg.

The traveler stormed out angrily.  It was many hours before enlightenment struck him.

Saturday, June 13, 2015

Tim Hunt: Not a martyr

As with most incidents relating to the feminism vs. "men's rights" debate, I had planned on quietly ignoring the Tim Hunt issue.  Like previous events (donglegate, elevatorgate, etc.), this one is a fairly straightforward issue (Should Tim Hunt have said those things?  No, of course not) with a lot of stupid internet drama on the side (though since I left reddit, I have seen a lot less of that), and I prefer not to contribute to the latter.

But then I read a fascinatingly unhinged article in Reason.  I got about halfway through before I decided I wanted to blog about it.  The basic premise seems to be that Hunt is being oppressed in some fashion.  The truly bizarre part, however, is who's (allegedly) doing the oppression.

Sunday, October 19, 2014

Meta-Compatibilism

Salviati
A few days ago, I bought a $5 desk toy on Amazon. Now that it's here, I'm regretting the purchase. It's not nearly as good as I expected. Oh well, it's not that much money.
Simplicio
Do you ever wonder if you could have done things differently?
Salviati
What do you mean?
Simplicio
Well, take that toy, for example. Could you have decided not to buy it?
Salviati
Well, if I had known I wouldn't like it, of course I wouldn't have bought it.
Simplicio
That's not what I meant. Could you have chosen differently if you hadn't known?
Salviati
What are you talking about? I didn't know and I did buy it. What more is there to discuss?
Simplicio
Were you making a real choice, or just following the laws of physics?
Salviati
What is a "real" choice?
Simplicio
A choice which could have come out differently.
Salviati
If I had decided by flipping a coin, then it could have come out differently. But that doesn't really strike me as much of a choice.
Simplicio
No, the coin's motion is determined by chaotic air currents and subtle physical factors. There isn't any real randomness there.
Salviati
OK, what if I use a Geiger counter hooked up to a radioactive mineral? Unless you subscribe to a hidden variable theory (which I do not), the counter's clicking is truly random. No matter how much you know about the situation, you can never predict exactly when it will go off.
Simplicio
We're missing the point. I don't want to know whether a Geiger counter could have made a different choice. I want to know whether you could have made a different choice.
Salviati
Either some part of my brain acts like a miniature Geiger counter, or no such part exists. If it does exist, then yes, I could have "chosen" differently, but I don't think you'll want to count that either. If it doesn't, then obviously not.
Simplicio
So you admit it! You did not make a real choice, because real choices don't exist. We're all slaves to physics.
Salviati
Nonsense. I wanted it, and purchased it because I felt like it. My action directly resulted from my desire. No one forced me to buy it. Physics isn't a person, actively controlling my life. You still haven't given me a definition of "real choice."
Simplicio
A real choice is a choice you could have made differently, under the same circumstances, under your own conscious direction.
Salviati
But why would I want to? At the time, I thought it was a grand idea. In that state of mind, why wouldn't I buy it?
Simplicio
That's irrelevant. The question is whether you could have chosen differently, not whether you actually would have.
Salviati
What's the difference between "I could have chosen differently, but never would have," and "I could not have chosen differently?" Those sound like the same thing to me.
Simplicio
They're not. "Could" is physics. "Would" is choice.
Salviati
But you just said choice doesn't exist. Besides, how can choice be independent of physics? Unless you want to start talking about an immortal soul or something...
Simplicio
It doesn't matter. A choice-making soul would have the same logical problems as a choice-making brain. And this quibbling is pointless. Choice, as I've defined it, doesn't exist. We both agree on that much, I think.
Salviati
It doesn't exist because it is ill-defined.
Simplicio
No, it doesn't exist because it fails to refer.
Salviati
The desk toy was just an example. Setting it aside for now, all of your arguments have been a priori, that is, logical reasoning divorced from empirical evidence. If you demonstrate by logic that something can't exist, it must be logically inconsistent. You've argued that your own definition of choice is logically inconsistent. Your position is the same as mine.

The above writing format is a blatant ripoff of Galileo. I find it rather convenient, but it is admittedly unoriginal.

Friday, September 19, 2014

The Pendulum and the Winch

I often find that explaining computer science to non-computer-scientists is difficult.  It's been said that computer science is like no other field of study.  Well, I think that's a rather strong claim to make.  What follows is a translation of a standard problem in computer science into physics.  It is an analogy, unrealistic but nevertheless interesting.

I have a pendulum, supported by some apparatus ultimately connected to a pillar or pole.  It is possible to move the apparatus up or down, but only by manually detaching and reattaching it by hand.  I have a winch affixed to this apparatus which may raise or lower the pendulum.  It is connected to a coil of rope or string (which, for the purposes of this problem, is infinitely long yet magically takes up a finite volume), and can be remotely controlled at the press of a button.  The winch is also geared discretely; it only turns in units, and then only one at a time.

I wish to carry out a series of experiments involving varying the length of my pendulum.  In particular, I often want to lengthen the pendulum.  Most of the time, this setup suits me quite well.  But sometimes, I find I need a pendulum longer than the apparatus is high off the ground.  In these situations, I need to climb the pillar and move the winch up.  In so doing, I may need to start an entire experiment over again because the pendulum lost energy while I was climbing.  How can I avoid or minimize those climbs in proportion to the maximum length of the pendulum?  We must assume I do not know the maximum length in advance, perhaps because my experiments are highly complex and difficult to predict, or perhaps because they are directed by someone else's instructions, and they did not think to tell me in advance how long a pendulum I would need.

Thursday, August 1, 2013

Singularities happen all the time

We will soon create intelligences greater than our own. When this happens, human history will have reached a kind of singularity, an intellectual transition as impenetrable as the knotted space-time at the center of a black hole, and the world will pass far beyond our understanding. -- Vernor Vinge, 1983
 The technological singularity is supposed to occur when we develop "true" or "strong" AI.  Beyond that point, we are told, everything will be different, in the most conveniently vague ways.  Perhaps society will run on communism, or anarcho-capitalism, or something we don't have a name for (in other words, whatever the author happens to think would be ideal).  We are told that the resulting society will be totally incomprehensible to those of us still living in the present day.

My reaction to all this can be summed up in two words: "So what?"

Wednesday, June 26, 2013

DOMA is alive... for now

Earlier today, the Supreme Court struck down the Defense of Marriage Act.

Well, actually, that's not technically true.  SCOTUS struck down section 3 of DOMA, which prevents the federal government from giving marriage benefits to same-sex couples.  Section 2 of DOMA, which permits a state without same-sex marriage to deny recognition of same-sex marriages from other states, is still in force, at least for the moment.  But section 2 is a legal nightmare.

Ordinarily, when you sign a contract, its validity is a federal matter.  Either it is valid in every state, or it is valid in no state.  Marriage no longer works that way.  Suppose two men are married in New York.  Under Windsor, the federal government now recognizes that marriage, and extends tax and other benefits to them.  But then they travel to Texas, which does not recognize same-sex marriage.  Suddenly, they are single.  Or are they?  It's unclear whether the federal government should apply New York or Texas law in determining benefits.  But clearly, as far as the state of Texas is concerned, the men are single.

Next, they go to California, where (it would seem, given the outcome of Perry) same-sex marriage is recognized.  Are they married again?  Did their original marriage contract from New York survive this transition?  Or did it vanish at the Texas border?  If it did, then that suggests a contract has been dissolved without any legal process, which seems troubling to me.  If it didn't, then why wasn't it in force in Texas?  Was it in abeyance somehow?

If the contract was in some kind of legal limbo, but not actually dead, this suggests a rather interesting situation.  A contract is valid but unenforceable thanks to a provision of Texas's state laws.  State laws aren't allowed to impair contracts under the Contract Clause.  But maybe Congress can authorize them to do so via DOMA.  Let's consider that.

Section 2 of DOMA is as follows:
No State, territory, or possession of the United States, or Indian tribe, shall be required to give effect to any public act, record, or judicial proceeding of any other State, territory, possession, or tribe respecting a relationship between persons of the same sex that is treated as a marriage under the laws of such other State, territory, possession, or tribe, or a right or claim arising from such relationship.

I find the term "required" rather interesting in this context.  Required by whom, exactly?  If it means "required by the courts," then this seems an entirely inappropriate attempt to dictate the outcomes of court cases.  Under the doctrine of separation of powers, Congress isn't supposed to be doing that.

On the other hand, if it refers to constitutional requirement (i.e. "required by the constitution"), that really isn't much better.  If the constitution says one thing, and the law says something else, generally the constitution wins.  Laws aren't allowed to dictate how the constitution is interpreted; again, that's a matter for the judiciary.

Just about the only "required" that I believe Congress could refer to here would be "required by federal law."  But if that's what the statute means, I don't think it will have any effect whatsoever.  I'm not aware of any attempts by federal law to require Texas to recognize a same-sex marriage.

In conclusion, it's not at all clear to me that DOMA section 2 even needs to be challenged on due process and equal protection grounds.  It could fall to separation of powers.

Updated: It's been brought to my attention that the contract clause is inapplicable to marriage contracts under longstanding precedent.  This is why I'm not a lawyer.  All the same, there are quite a few interesting questions raised above, so I'm leaving this post up.

Thursday, April 25, 2013

Nihilism and optimism

meaning
n. the end, purpose, or significance of something
NB: Emphasis added.
Consider the definition given above by Dictionary.com. We're told the meaning of something is its purpose.  If a thing has a purpose, that purpose must have been intended by someone.  If we're told something has "inherent meaning," we must ask from whence this intent comes.  There doesn't seem to be an obvious answer to this question.

Saturday, July 21, 2012

SpaceChem optimization

SpaceChem is a programming video game disguised as a chemistry video game.  A static description cannot really do it justice, so here's a trailer:


Honestly, the trailer doesn't do it justice either, so maybe you should go grab the demo from Steam.  Anyway, SpaceChem has two types of puzzles: Research and Pipeline puzzles.  Research puzzles are fairly straightforward to work with because an input/output operation always takes exactly one cycle, whereas with a Pipeline puzzle, the tubes pipes can be clogged or empty, making your I/O operations block.  This means that performance problems with one reactor can affect others.  But optimization is not an all-or-nothing affair.  You need to know where to concentrate your work.  That's what this post is about.

Saturday, July 7, 2012

The worst-case scenario

A lot of the lessons from Fukushima have been obvious for a while. Nuclear safety is a global challenge, and every country has to learn from the best practices of others. These best practices include retrofitting passive safety features wherever possible, and continuing to update safety measures in response to our changing understanding of the plant's environment. -- Ars Technica (emphasis added)
 This advice certainly sounds right, to me.  But when I check consequentialism, I find that the words "whenever possible" give me pause.  On the one hand, it seems that our only question should be "What effect does a given safety measure have on actual safety?"  But proper consequentialism requires a two-sided analysis, so we must also ask "How much will this cost in relation to the expected number of lives saved?  Is it worth it?"

I don't like this conclusion.

It certainly seems logical enough: if we're to make a change, we must do a proper cost-benefit analysis.  But imagine this hypothetical: you're provided with an investing opportunity.  The expected value is better than any other investment you're likely to find, and you're sure that it is legitimate.  However, it's a risky investment, with a chance of returning nothing at all, not even the money you put in.  I don't think any sane person would invest all of their money in such a scheme, and I don't think this falls under irrational risk aversion either.  Yet that is exactly what basic economics (which is very similar to utilitarianism) says we ought to do, perhaps leaving some money out for basic living expenses, but certainly without a safety net.  If someone did invest all their money like that, and ended up bankrupt, they would have only themself to blame.

Of course, most real financial analysts would never do this, instead preferring to diversify.  But I can't understand how you get from "throw all your money at the best expected value" to "diversify", and I think it's just a kludge to make the system work right.

What can we distil from this?  I think it's clear that we need to consider the worst-case scenario in any evaluation.  But which one?  A situation can always be worse.  So, to keep this reasonable, we need to limit ourselves to outcomes which are related to the proposed action: those outcomes whose probabilities are significantly affected by our proposed action.  Of those outcomes, we should focus on the very worst.  We need to ask ourselves "Is this outcome tolerable?  What effect does our decision have on its likelihood?"

But what of utilitarianism?  This doesn't seem compatible with it.  I feel that we may revise utilitarianism if we find it necessary; I may explain why in a later post.

Sunday, May 6, 2012

Copyright is a subsidy

The Congress shall have Power... To promote the Progress of Science and useful Arts, by securing for limited Times to Authors and Inventors the exclusive Right to their respective Writings and Discoveries. -- Copyright Clause, United States Constitution
As you can see, the rationale for copyright, in the US at least, is about promoting progress. It has nothing to do with notional "rights" of authors, and is explicitly not a property right. But the Constitution was a long time ago; maybe laws have changed focus since then. Well, no. The Copyright Act of 1790 bills itself as "An Act for the encouragement of learning." It was amended in 1831, primarily to extend it, with very little discussion of its purpose. A major revamping was undertaken in 1909, again with very little discussion of purpose. Finally, more changes were made in 1976, which is still good law, and once more, it failed to specify a purpose for copyright. The only purpose of copyright is its original purpose; no new purpose has been specified, so we must conclude that Congress was satisfied with the Constitution and the original act.

Now, of course, everything the government does is supposed to be for our benefit, in theory, though perhaps not in practice. So naturally the question arises as to whether copyright, in the above context, really qualifies as a "subsidy" per se. I think it does. A subsidy, in traditional terms, is money paid (usually by the government) to a business or industry to encourage that business model, theoretically due to positive externalities. However, in practice, the term may also be used to describe the government consistently favoring one company or industry over another in e.g. government contracts. From this, we see a broader principle: a subsidy is an action, typically by the government, which encourages a particular behavior via an economic incentive, at the cost of a reduction in competition, for the benefit of the public at large. Well, let's look at copyright through that lens. Copyright is defined as a limited monopoly granted by the government, so it's clearly an economic incentive which reduces competition. Theoretically, it's supposed to encourage the authorship and publication of creative works. This is supposed to benefit the public because of the mere existence of those works, and because, theoretically, they'll eventually enter the public domain for all to enjoy; this is a positive externality. That certainly seems to meet the criteria I specified above. Perhaps this definition is too liberal, but the principle is still there: copyright exists to benefit the public, not the author.

Now, I'm not saying that all copyright is inherently evil; I've never said that subsidies are necessarily bad. Indeed, it's thanks to copyright that we have many high-quality works. But I do feel that the reduction in competition means that there is a balance: there must be some point above which a particular subsidy does more harm than good, as the loss in competition eventually outweighs any public benefit. Of course, someone espousing a command economy would probably disagree with me on this point, but I feel the difference in opinion there is rather beyond the scope of this post. This principle applies quite nicely to copyright. Currently, copyright lasts for 70 years after the death of the author; essentially two and a half generations. It is not clear to me that this effectively "promote[s] the Progress" of anything. If it confers no benefit to the public as a whole, why are we doing it?

Sunday, April 22, 2012

Truth in turnstiles

We're often told that "logic" is at the heart of mathematics. We're told that you cannot do math without logic, that mathematics requires it. Personally, I subscribe to the view of formalism, which basically says that math is the manipulation of symbols according to rules. Do we need full-blown propositional logic to manipulate symbols? I hope not.

We need to decide what we mean by "logic." There are a lot of different kinds, believe it or not, and it's not just a matter of expressive power. Alternative logics often entirely disagree with "classical" or typical logic. For instance, paraconsistent logic will tolerate a contradiction without going nuts, and relevance logic takes perhaps a more intuitive approach to material implication, though it's also more complex. When we say "logic," we often mean classical logic, but I honestly cannot see why it should be privileged over other logics. Classical logic is more intuitive than paraconsistent logic, but at the cost of increased complexity (and fragility). On the other hand, it's less intuitive than relevance logic, for the sake of simplicity. Now, maybe this is a happy medium along a spectrum of intuition versus simplicity. But it seems to me that if you're building the foundation of mathematics, you'll favor simplicity over intuition; a happy medium isn't your goal.

The foundation of mathematics, in truth, is entailment, represented by the turnstile. Entailment basically means "given some statements (which look like) X, you can prove another statement (which looks like) Y." Note that this is very different from material implication, which isn't even meaningful at this level (because we haven't even picked a logic yet, let alone laid out its axioms). The actual axioms you're working with can then be defined using the turnstile. Those axioms are often logical in nature, to lay a strong foundation for other mathematical principles (such as ZFC), but there's no requirement that we use logic at this stage. You could, for instance, define the rules of untyped lambda calculus (which are themselves fairly simple) using only the turnstile, and then you would have a Turing-complete system that was defined without logic at all!

So where does this leave us? Different logics have different uses, and we can pick which one we want or need on a case-by-case basis. The turnstile is used to formalize this detachment, making it a framework for choosing a logical system. But we should remember that, technically, we don't need to use a logical system at all. It just happens to be quite convenient to do so.

Tuesday, April 10, 2012

Sherlock Holmes was wrong

It is a capital mistake to theorize before one has data. Insensibly one begins to twist facts to suit theories, instead of theories to suit facts. --Sherlock Holmes, A Scandal in Bohemia
To the average person, the above quote seems eminently reasonable. If you don't know what you're talking about, you probably shouldn't guess. But, truth be told, he's dead wrong.

One of the less obvious fallacies we have to contend with is the Texas sharpshooter fallacy. It happens when you theorize after getting your data, when you twist theories to suit facts. But why is this a fallacy? Well, suppose that I hand you a long list of numbers and ask you to theorize about it. You spend hours carefully examining the data, feeding it through complex and abstruse equations, until eventually you come up with a baroque formula that exactly reproduces every number in the list.

But then I give you some more numbers, generated by the same process, and your formula gives totally wrong answers! How can this be? Well, the numbers were randomly generated all along; there never was a pattern. Now, this is a rather extreme case, but humans are wired to find patterns in everything.

Here's another example, one which actually happens from time to time. Suppose you have a large sample from a huge population, and you start taking cross-sections of that data. In other words, you start pulling out and examining chunks of data at a time. You take a lot of cross-sections, and eventually, one of them shows some unusual pattern. If you assume that pattern also holds in the larger population, you are committing the fallacy. You're already working from a sample; taking samples of that sample is iffy at best. You've already assumed the larger sample to be representative, and you're now adding the assumption that the smaller sample is also good. Worse, you've specifically selected for the particular cross-section that shows an unusual result! If any of your cross-sections shows an unusual result, purely by chance, you'll find it sooner or later.

So if we shouldn't twist theories to suit facts, does that force us to do the reverse? Certainly not! The proper way to do this sort of reasoning is to theorize in advance, and be prepared to discard your theory as soon as it looks wrong. This way, you're not twisting either to suit the other: you're scrapping bad theories and replacing them with (hopefully) good theories. Of course, you will let your previous theories influence your new theory, so in a sense it could be likened to twisting your theories, but really, the important thing here is that you have a viable theory before you receive new data, so that you can test your theory on data it wasn't based on. In a way, basing your theory on the data it's supposed to explain is cheating, since you're not really testing anything; you're just finding a pattern.