Sententia cdsmithus

May 17, 2008

The Best Nigerian Scam Email Ever

Filed under: Uncategorized — cdsmith @ 10:39 am

I just received this email. The irony is great.

Subject: SCAMMED VICTIM COMPENSATION

Rev.Dr.Abraham Newman
Regional Director to Nigeria
International Drug and Terrorist Enforcement (IDTE)
United Nations Office,3 Whitehall Court
SW1A 2EL London U.K
Phone:+44 7045767393
Email: infoidte@yahoo.co.uk
Alt.stben09@gmail.com

Good day,

This is to bring to your notice that I,Rev.Dr.Abraham Newman, United Nations Regional Director to Nigeria representing the International Drug and Terrorist Enforcement (IDTE) has been appointed by United Nation/International Financial & Economic Crime Unit to Nigeria in association with AFRICA DEVELOPMENT BANK to pay 150 scammed victim’s the sum of $1000,000 USD (One million Dollars) each. You have been listed and approved for this payment as one of the scammed victims to be paid this amount in the second phase of the Economy Reform Project; I would like you to Provide/confirm your detail, so that your compensation would be paid out to you. Get back to me as soon as possible for more details on the immediate payments of your $1000, 000 USD compensations/Beneficiary funds.

According to the number of applicants at hand, 114 Beneficiaries has been paid, Most of the victims are from the United States while the rest are Europeans and Asians, and we still have more 36 left to be paid the compensations of $860,000 USD each. Your particulars was mentioned by one of the Syndicates who was arrested in Lagos, Nigeria as one of their victims of the operations, you are hereby warned not to communicate or duplicate this message to him/anyone for any reason what so ever as the Interpol is already on trace of the criminal. So keep it secret till they are all apprehended.

Other victims who have not been contacted can submit their application as well for scrutiny and possible consideration.

You can receive your compensations payments via ATM CASH CARD. I shall feed you with further modalities as soon as I hear from you.

Yours faithfully,
Rev.Dr.Abraham Newman
+44 7045767393

May 6, 2008

Why licenses don’t matter (and why they do)

Filed under: Uncategorized — cdsmith @ 3:04 pm

There’s a fairly long history in the free software and open source communities of being very interested in licensing. It’s always been ironic to me, since free software is supposed to be about not exercising control over how people use your software. Most recently, I read this article on whether the GPL can be “revoked” on a project to which it has already been applied. There are any number of other issues: Can this library be used by that project? Can I relicense your code to a less permissive license without making any substantial changes? And so on…

I am of the opinion that the legal meaning of a license is completely irrelevant. It doesn’t matter what someone has the legal ability to do. It’s necessary to pay attention to the social influence and intentions of others.

Example : MySQL

Let me make the point by giving an example. In fact, there’s one example that covers this very well. Think about MySQL, the database company. Yes, they are most definitely a company, with all the overriding profit motive that implies. Profit motive isn’t bad; but it is a motive that might not align with your best interests. They wrote this database, and released it under the GPL. It made a big name for itself by being a “free” database. In fact, at least until very recently, it was a really crappy database that couldn’t do basic stuff like transactions or handling reasonably complex SQL; the only reason you’ve ever heard of it is that it is “free”. But it’s also dual licensed as a commercial database; and here’s the rub: ultimately, the GPL nature only matters if MySQL wants it to matter. They let it matter when it means free publicity and a cult following; but when they see the opportunity for a profit, the GPL suddenly seems to grant you a lot fewer rights that you thought it did. The legal and semantic machinery going on is rather elaborate; but it is not the point. It’s only the excuse. What it comes down to is this:

  1. MySQL can afford to hire a lawyer, and you probably can’t.
  2. People accept MySQL as the expert on what “their” license means.

What this means is this: if you use MySQL, you accept that you are at the mercy of MySQL’s whims. If they decide you should give them money, you give them money. In fact, it goes further than that. As a test, some years ago, I approached a MySQL representative by email about one of the more peculiar and ridiculous re-interpretations of English words that they put forth. In particular, I asked this. Suppose I had an application (not free software itself) written in Java using JDBC; and that I distributed it with PostgreSQL, but since the application just uses simple SQL and JDBC, someone who uses my software might conceivably download MySQL and use that instead. In fact, suppose I have customers who I suspect have done just that, since they prefer the administration tools for MySQL. The response was a rather obtuse legal threat: something like “We can’t give you legal advice, but it’s always safest for you to buy a license. The protection you get will be worth the investment.” They want me to buy protection. To bastardize a line from a Patricia Briggs book: And yes, just like the mafia, MySQL only protects you from themselves.

So if you have a free software application and the company doesn’t see any other reason to make a threat, then you may use MySQL. But the other rights in the GPL are lost. If you download MySQL and it interacts with some other (possibly non-free, possibly threatening to MySQL) application using publicly specified interfaces, MySQL feels they have the right to sue someone. If you modify MySQL and try to distribute your changes, who knows what would happen? And don’t imagine for a second that you could get away with forking the code, which is in the end the most fundamental free software right. If you had any success, there would be lawyers knocking on your door before you could sneeze.

Lessons from the example

So this is the situation we’re in. You may have legal rights granted to you by a document like the GPL (or BSD, or MIT, or Creative Commons, or…) But because some other party holds some kind of power over you, you can’t really trust your ability to exercise those rights reliably. Of course, there are many kinds of power involved here. Not everyone is motivated by profit. Some people are motivated by social status, or even a sincere desire to do good. Power might include:

  1. Financial power. You can’t hire a lawyer, a company profiting from their software can.
  2. Presumed authority. Since the software provider chose the license, people take their word on what it means. This is regardless of the fact that in the free software world, virtually no one except major figureheads actually writes their own licenses.
  3. Social expectations. Even if I can get away with doing something that the author of the software doesn’t like, if they are going to be upset my it I’ll probably take a pass. It would take a definite jerk to ignore the wishes of the person who did all that work and made it freely available to you.

But whatever the kind of influence being wielded (and some of those kinds of influence are not entirely bad) the fact remains that you can’t tell everything about your ability to use software by the written license.

What now?

So how did we get here? What do we do?

I think how we got here is that we’re computer programmers. Computer programmers, by nature, tend to look for simple and unambiguous rules that define what is possible. The license pretends to be that, and we miss that it’s a false set of rules. It’s a set of rules only in theory, in an idealized sort of half-egalitarian, half Ayn Rand world, where everyone acts in their own best interests and has an equal understanding that others will too, and everyone is on equal footing in terms of the power they have to act in those interests. Legal absolutism simply doesn’t translate into the real world, as much as we’d like to see it happen.

Instead, we need to realize what people have known since the beginning of time - but we’ve tried to forget. It matters who you are dealing with. We should take the time to find out the motivations of the people who build the things we use. In particular, there are different kinds of groups of people building free or open-source software. At least a few of them are as follows. (Of course, I’m grabbing archetypes that no one will meet exactly. There’s no intention that you can’t span a few of these groups.)

  • Commercializers. These are people who completely believe in their ability to turn a profit by building open source software. They are often the dual-licensers, GPL+commercial, or sometimes the support sellers, or sometimes the people who build service businesses and use their software to provide those services. In any case, the open source side is likely to use the GPL or a similar restrictive license just to stop the competition. In its purest form, this sort of group doesn’t care about you unless you are making them a profit. Maybe you’re actually paying them. Maybe you’re getting your customers to pay them. Maybe you’re giving them positive reviews and claims of popularity that they can use to take other people’s money. Just make sure your intentions don’t conflict with their commercial interest. This is the most dangerous group, as business sorts tend to believe it’s a perfectly normal “strategic decision” to make other people miserable.
  • Idealists. Some groups are motivated by the pure idea that software should be free. This certainly includes the entire GNU organization, and a number of others to boot. The GPL license is pretty popular here. The motivation is to make more software free. If you aren’t building free software, this might be a good time to ask yourself if taking advantage of these people’s work is the right thing to do. On the other hand, very few people are really extremists here. No one is going to hate you for using gcc to compile and build closed commercial software; but you might be careful if the project is newer, and particularly if it’s a library licensed under the GPL, which is a clear sign that the authors don’t want you to do that. (The legal meaning doesn’t matter; it wouldn’t be okay to use readline in a commercial product even if it turns out the license is unenforcable.)
  • Social Groups. Often, free software is built by groups who are just having fun. They want to develop ideas, work with other people, but avoid having obligations to customers or dealing with business concepts like marketing, payroll, etc. Most of these groups will license software under the BSD or another very permissive license. In less software-oriented groups, Creative Commons is also popular here. They don’t care what you do with their software, so long as you don’t try to keep them from doing as they please. Many groups of this form will be happy to hear that you are finding their software useful. The biggest way to piss these people off is to adopt an attitude of entitlement. If you avoid that, you’re fine.
  • Academics. This last group is interested in writing the software for the sake of writing it, learning what they can from it, and moving on. They will be thrilled if you use their software to solve other interesting problems. (And I mean interesting in the academic sense.) If you just have fun, they won’t mind. If you commercialize it, expect an attitude of profound apathy. There are academics who are interested in commercializing their work, but they don’t release their software with free licenses. Most academic work tends to be released under BSD, MIT, or similar licenses. In fact, it’s worth noting that both of those licenses are named after the major universities where they were originally written.

Licenses matter after all

While I started this rant by saying that licenses don’t matter (in terms of the legal rights they grant you), it turns out that they actually matter quite a bit (because it helps you tell what kind of group you’re working with). This is important for using a project. It’s also important for getting involved in a project.

Here’s a true story. A few years back, I got involved in a group that was building libraries for C programming on an embedded device. I write a lot of code for dealing with an LCD controlled, and built a graphics library and a user interface library on top of that. Then one day, someone wanted to use our libraries to write a commercial application for these devices. There followed a massive debate, wherein I realized that I had completely different goals than anyone else. I’d just been having fun. Others were talking about setting up a commercial dual license, deciding how to apportion the profits; or else insisting that we had built this to encourage free software, and we shouldn’t just give it away to people who would make money on the backs of our efforts.

The project had been licensed under the GPL. In retrospect, I should have asked more questions about that before I got involved. I just assumed it was the easy default choice, since it’s the license more people have heard of. It turns out that some people in the project thought it mattered quite a bit. Lesson: the license is a good way to get an initial idea of the kind of people you’ll be working with in a project.

Anyway, that’s my rant.

May 4, 2008

Solving a Logic Problem with Coq

Filed under: Uncategorized — cdsmith @ 10:48 am

I’ve been playing around with the Coq proof assistant tool over the weekend. Here’s an interesting problem and its solution proven with Coq. I am by no means an expert in this. I’ve used Coq for less than 6 hours at this point. There are a lot of nicer tutorials out there, including the one on the Coq web site. But this is an interesting motivating example, and I’m writing to share my experiences.

The puzzle I’ll solve here comes from John Pratt’s page. A lot of supposed “logic puzzle” sites aren’t really logic puzzles at all, but just plays on words; but that one is okay. Here’s the puzzle:

When asked her 3 children’s ages, Mrs. Muddled said that Alice is the youngest unless Bill is, and that if Carl isn’t the youngest then Alice is the oldest. Who is the oldest and who is the youngest?

The first step is to start up Coq. In my case I’ve generally used CoqIde, which is a simple apt-get in Ubuntu. However, for this blog post I’ll use the command-line coq-interface in hopes of more portability. Let’s tell Coq a few of the basics of the problem, such as that there’s a domain of discourse, and it has three children in it named Alice, Bill, and Carl.

Section Ages.
Variable Child : Set.
Variable Alice : Child.
Variable Bill  : Child.
Variable Carl  : Child.
Variable Youngest : Child -> Prop.
Variable Oldest   : Child -> Prop.

The last two lines declare unary predicates for the domain of discourse, indicating whether a child is the youngest or the oldest. Unfortunately, Coq doesn’t know some things that we’re assuming here. One such fact is that the three children are different from each other. So let’s tell it that.

Hypothesis Diff1 : Alice <> Carl.
Hypothesis Diff2 : Bill  <> Carl.
Hypothesis Diff3 : Alice <> Bill.

Each of these hypotheses has a name, so that we can refer to it in the proof later.

Next, there’s some implicit meaning in the superlative words “youngest” and “oldest”.

Hypothesis Superlative1 : forall A B, (A <> B) -> Youngest A -> ~Youngest B.
Hypothesis Superlative2 : forall A B, (A <> B) -> Oldest   A -> ~Oldest   B.

In other words, you can’t have two different children who are both the youngest or the oldest. Even twins are usually born a few minutes apart!

Finally, “youngest” and “oldest” are opposites. Since there is more than one child, no one can be both.

Hypothesis Antonym1 : forall A, Oldest   A -> ~ Youngest A.
Hypothesis Antonym2 : forall A, Youngest A -> ~ Oldest   A.

Having now explained the terminology to Coq, we may now enter the information given by Mrs. Muddled in the problem.

Hypothesis Given1 : ~ Youngest Alice -> Youngest Bill.
Hypothesis Given2 : ~ Youngest Carl  -> Oldest Alice.

Now that Coq understands the premises, we need to tell it what we are proving. That requires solving the puzzle. Simple enough: Alice is the youngest unless Bill is, which means Carl can’t be the youngest. But if Carl is not the youngest, then Alice is the oldest, which leaves Bill as the youngest. So the youngest is Bill, the middle child is Carl, and the oldest is Alice. Let’s tell Coq that.

Goal Oldest Alice /\ Youngest Bill.

And Coq responds by listing the goal, and all the hypotheses we may use to prove it:

1 subgoal

  Child : Set
  Alice : Child
  Bill : Child
  Carl : Child
  Youngest : Child -> Prop
  Oldest : Child -> Prop
  Diff1 : Alice <> Carl
  Diff2 : Bill <> Carl
  Diff3 : Alice <> Bill
  Superlative1 : forall A B : Child, A <> B -> Youngest A -> ~ Youngest B
  Superlative2 : forall A B : Child, A <> B -> Oldest A -> ~ Oldest B
  Antonym1 : forall A : Child, Oldest A -> ~ Youngest A
  Antonym2 : forall A : Child, Youngest A -> ~ Oldest A
  Given1 : ~ Youngest Alice -> Youngest Bill
  Given2 : ~ Youngest Carl -> Oldest Alice
  ============================
   Oldest Alice /\ Youngest Bill

Fair enough. The proof wizard doesn’t know how to solve this, so we’ll need to take it on by hand. To prove a conjunction, we can individually prove each side. Coq calls this the “split” tactic.

split.

And Coq responds:

2 subgoals

  Child : Set
  Alice : Child
  Bill : Child
  Carl : Child
  Youngest : Child -> Prop
  Oldest : Child -> Prop
  Diff1 : Alice <> Carl
  Diff2 : Bill <> Carl
  Diff3 : Alice <> Bill
  Superlative1 : forall A B : Child, A <> B -> Youngest A -> ~ Youngest B
  Superlative2 : forall A B : Child, A <> B -> Oldest A -> ~ Oldest B
  Antonym1 : forall A : Child, Oldest A -> ~ Youngest A
  Antonym2 : forall A : Child, Youngest A -> ~ Oldest A
  Given1 : ~ Youngest Alice -> Youngest Bill
  Given2 : ~ Youngest Carl -> Oldest Alice
  ============================
   Oldest Alice

subgoal 2 is:
 Youngest Bill

In other words, we’re currently working on proving Oldest Alice, but once we finish that, we’ll need to prove Youngest Bill. Well, there’s only one good way to conclude Oldest Alice, and that’s to show that Carl is not the youngest. So let’s prove the current subgoal by applying Given2.

apply Given2.

I’ll stop quoting the entirety of Coq’s responses, but here’s the important part:

  ============================
   ~ Youngest Carl

So how do we know that Carl is not the youngest? Well, it’s because Bill is the youngest. That’s rule Superlative1, but we’ll also have to tell Coq to use Bill as the other child.

apply Superlative1 with Bill.

And Coq responds:

  ============================
   Bill <> Carl

subgoal 2 is:
 Youngest Bill

So we need to prove that Bill is not Carl, and then that Bill is the youngest. (That Bill is the youngest is also subgoal 3 left over from splitting the conjunction, a fact that we’ll think about shortly.) For now, it’s easy to prove that Bill is not Carl, because that was one of our hypotheses.

apply Diff2.

And Coq responds:

  ============================
   Youngest Bill

Now it remains only to prove that Bill is the youngest. The way to go about that is to apply the first given.

apply Given1.

And Coq responds:

  ============================
   ~ Youngest Alice

This is the tricky part. The reason that Alice is not the youngest is that if she were the youngest, then Carl would not be the youngest, but then the second given statement would lead us to conclude that Alice is the oldest, which is a contradiction. Proof by contradiction, though, is generally a technique valid only in classical logic, not in the constructive logic that Coq typically uses. It turns out we won’t need to resort to classical logic for this theorem, but just to make things easier in our first pass we’ll go ahead and use it. This is one statement in Coq.

Require Import Classical.

So now having classical logic at our disposal, we can go about proving that Alice is not the youngest by applying Peirce’s law.

apply Peirce.

And Coq’s response:

  ============================
   (~ Youngest Alice -> False) -> ~ Youngest Alice

We’ll split up the implication by giving a name to the hypothesis and then proving the conclusion. This tactic is called “intro”.

intro H.

Coq responds:

  H : ~ Youngest Alice -> False
  ============================
   ~ Youngest Alice

Note that the new hypothesis is the double-negation of “Alice is the youngest.” In classical logic, which we’re now using, that’s the same as Alice being the youngest, so we’ve essentially used Peirce’s law to start the proof by contradiction. Now we’ll go backward through the contradiction argument given above. First, Alice can’t be the youngest because she’s the oldest. She’s the oldest because Carl is not the youngest. Carl is not the youngest because we’ve assumed (to obtain the contradiction) that Alice is the youngest.

apply Antonym1.
apply Given2.
apply Superlative1 with Alice.
apply Diff1.

And here’s where we are, according to Coq.

  H : ~ Youngest Alice -> False
  ============================
   Youngest Alice

This is just a double negation: a rule from the Classical package that goes by the name NNPP. Once we double-negate the conclusion, it will look slightly different from the hypothesis H, but they will actually mean the same thing. (~A is just shorthand for A -> False).

apply NNPP.
exact H.

Coq says:

  ============================
   Youngest Bill

So we’ve proven the left half of the conjunction: that Alice is the oldest. We now need to prove the right half. But wait! We already did that, as the second step to proving the left half. For now, we’ll just copy and paste the last part of the earlier proof.

apply Given1.
apply Peirce.
intro H.
apply Antonym1.
apply Given2.
apply Superlative1 with Alice.
apply Diff1.
apply NNPP.
exact H.

and Coq says:

Proof completed.

Finally, we get to say:

Qed.

Ah, we’re done. But it turns out we can improve the proof a little by using a few more Coq features: specifically, by proving some lemmas (or lemmata, if your prefer), and by eliminating the use of classical logic (since this happens to be a constructively valid statement; not all classically true statements will be, though).

First, although Peirce’s law ((~P -> P) -> P) is not true in constructive logic, but we can prove (P -> ~P) -> ~P. Let’s do so, by introducing a lemma, and then by using the automatic prover.

Lemma NPeirce : forall P : Prop, (P -> ~P) -> ~P.
auto.
Qed.

In this case, the automated theorem prover worked fine. We could have proven the theorem by hand, as well (by treating the ~P as P -> False, using the intro tactic, applying the modus ponens rule, and then easily satisfying all of the hypotheses). Using this, we can simplify our proof of Youngest Bill. The process is the same, but instead of applying Peirce’s law and the beginning and the double-negation at the end, we apply our new NPeirce lemma at the beginning, and we don’t need double-negation at the end.

Lemma YoungBill : Youngest Bill.
apply Given1.
apply NPeirce.
intro H.
apply Antonym1.
apply Given2.
apply Superlative1 with Alice.
apply Diff1.
exact H.
Qed.

Notice that I’ve also defined this as a lemma. That’s because we needed to prove it twice in the earlier attempt. May as well prove it once up front instead. So now comes the final goal.

Goal Oldest Alice /\ Youngest Bill.
split.
apply Given2.
apply Superlative1 with Bill.
apply Diff2.
apply YoungBill.
apply YoungBill.
Qed.

And we’re done. For reference, here’s the entire proof as entered in CoqIde.

Variable Child : Set.
Variable Alice : Child.
Variable Bill  : Child.
Variable Carl  : Child.
Variable Youngest : Child -> Prop.
Variable Oldest   : Child -> Prop.

Hypothesis Diff1 : Alice <> Carl.
Hypothesis Diff2 : Bill  <> Carl.
Hypothesis Diff3 : Alice <> Bill.

Hypothesis Superlative1 : forall A B, (A <> B) -> Youngest A -> ~Youngest B.
Hypothesis Superlative2 : forall A B, (A <> B) -> Oldest   A -> ~Oldest   B.

Hypothesis Antonym1 : forall A, Oldest   A -> ~ Youngest A.
Hypothesis Antonym2 : forall A, Youngest A -> ~ Oldest   A.

Hypothesis Given1 : ~ Youngest Alice -> Youngest Bill.
Hypothesis Given2 : ~ Youngest Carl  -> Oldest Alice.

Lemma NPeirce : forall P : Prop, (P -> ~P) -> ~P.
auto.
Qed.

Lemma YoungBill : Youngest Bill.
apply Given1.
apply NPeirce.
intro H.
apply Antonym1.
apply Given2.
apply Superlative1 with Alice.
apply Diff1.
exact H.
Qed.

Goal Oldest Alice /\ Youngest Bill.
split.
apply Given2.
apply Superlative1 with Bill.
apply Diff2.
apply YoungBill.
apply YoungBill.
Qed.

Blog at WordPress.com.