Posts Tagged ‘logic’

Reading, Hearing, and Processing Information You Don’t Like

No Gravatar

What do you do when you come across information you don’t want to hear, don’t like, and/or disagree with?

For some of us, that doesn’t happen very often. It isn’t too difficult to avoid people or media that don’t fit our particular worldview. Whether that means carefully choosing friends, or only listening to certain talk radio stations, or only watching certain TV channels, or only visiting certain websites, or only accepting certain Facebook friends, we are usually pretty good at filtering out the unknown or undesirable according to our own person beliefs.

While I can’t exactly blame people for doing that—it’s an easy way to stay within your “comfort zone”—I do believe it is an unfortunate loss for those people. Information that doesn’t fit with your worldview can’t hurt you unless you are argumentatively weak enough to suffer damage when presented with an opposing viewpoint. If you are afraid of listening, then you probably can’t back up your own beliefs, and you really ought either to be challenged or else to spend some time fleshing out your worldview post haste.

I am not implying that anyone who avoids some information is by definition afraid of hearing it. I know this is not true. You might want to avoid some outside influences because you are still trying to figure out exactly what you believe. You might have already heard a particular viewpoint, and you don’t feel the need to spend time hearing it again at the moment.

However, I propose that if you only think you disagree with a particular viewpoint, but you haven’t heard it in its entirety yet, then it is not a good idea to dismiss it or make any assumptions.

We do this with politics, economics, history, religion, sports, and just about anything else that can be argued in any way. It is chiefly visible with politics, and slightly less so with religion (less only because many people seem to be more willing to tolerate disagreements, though under the surface they are often even more dogmatic by comparison).

If you want to come to a well-founded and logical conclusion on a topic, it is critical to fully listen to people who disagree with you. This should give you an opportunity to identify whether:

  1. Their end goal is good or not
  2. They have thought through their argument
  3. They have logical fallacies in their argument
  4. They have made assumptions with any of their information

I often read articles that I empathize with but do not agree with. I find that when I disagree with someone, it usually isn’t because they want an end result that I don’t (though this does happen occasionally). It’s usually because they have made assumptions that I don’t believe are correct, or they have jumped to a conclusion that doesn’t follow from their foundation. In the latter case, it doesn’t always mean they are wrong, but it does mean they are missing some information and at least may be wrong because of it.

Sometimes though, listening completely to an opposing viewpoint can have a different affect: it can do any one (or more) of the above things to your own argument. There have been many times when I read or heard something that illuminated my own logical fallacies, incorrect assumptions, or missing information. If I had dismissed the opposing argument off-hand just because I thought I understood it or felt sure enough in my own viewpoint, I would still be wrong.

At the same time, I always believe that I could still be wrong.

There are no complex philosophical areas of my life where I am 100% confident that I am right. I am pretty sure in a few cases, but in many others, I only have some basic ideas or opinions that are incomplete. Whether they are right or not, I don’t feel confident enough to argue either way because I simply don’t know. It is in these areas that I am most eager to listen to anyone else’s viewpoint. But even in areas where I do feel confident, I am still always willing to listen to someone who disagrees, because it means I will either further solidify my argument through logical defense, or else I will learn where my argument is weak and then educate myself—possibly changing my opinion as a result.

The moment you believe you have the absolute correct answer to any question, you stop learning new things about it. This can be a problem even in areas as static and concrete as mathematics, which is about as absolute as you can possibly get in this world. People are still discovering new things about mathematics because they never assume that they know 100% of the existing solutions. 99.9%, perhaps, but never 100%.

I am not advocating relativism here, or saying that your worldview (especially religion) must always be in a state of flux. I am only saying that it is a good idea always to keep your mind open to challenges.

If your viewpoint is right, then you will be able to defend it.

If it is incomplete, you will be able to complete it.

And if it is wrong, then you will be willing to change it.

Political Labels and Logical Fallacies

No Gravatar

What do you think when you hear the term “Left-wing Liberal”? How about “tea party”? “Right-wing extremist”? “Die-hard Republican”? “Card-carrying member of the NRA”? “Reactionary”? “Obstructionist”? “Moderate”? “Libertarian”? “Independent”? “Neocon”? No matter what you believe, or what your personal political affiliation is (if you have one), the odds are good that those terms conjure up quite a few different images, some of which are bad.

While some of these kinds of labels are meant to be derogatory caricatures of the people we disagree with, many of them are not. The problem is that even the more “harmless” of these words mean significantly different things to the people who use them regularly. A self-identifying Republican thinks “Republican” is a good thing, while a self-identifying Democrat thinks “Republican” is a bad thing. Say the word in front of both of them, and two very different mental pictures will form in their respective heads. From a linguistic and logical standpoint this means that these words are fundamentally useless for worthwhile communication because their meanings have become arbitrary—not depending on context, which would still allow usefulness, but instead depending only on the personal meaning ascribed by the one using it.

I subscribe to many different political or environmental email newsletters. I don’t agree with most of them, but I like to read through the agendas of different organizations just so I get a well-rounded idea of what’s going on around the country. It’s saddening to me that the content from the organization I disagree with most (MoveOn) is usually the least full of distracting propaganda. Don’t get me wrong, they do have many other more subtle forms of propaganda. But the most blatant name-callers of all of them are often the ones that I agree with in principle. I just can’t stand their method of delivery, and I doubt their credibility because they resort to that kind of communication.

Political labels allow for an easy way for group members to identify themselves. However, I am virtually certain that most of the people who consider themselves part of a large group (such as MoveOn or, say, the Tea Party) either don’t agree with 100% of the agenda, or more likely don’t know 100% of the agenda and so cannot truly agree or disagree across the board. It is challenging even among family members to find someone who completely agrees with everything you believe.

Labels create a simple but inaccurate group identity among ideological subscribers, while at the same time they create a shallow but intense divisiveness between “believers” and “non-believers.” People often treat their own political beliefs like religious dogma and use opposite labels on their opponents as spiteful, condescending pejoratives. This makes it easy to fall prey to a logical fallacy commonly known as a straw-man argument. A straw-man argument entails the misrepresentation of the position of our opponent for the purpose of easily shooting it down. Such a position is easy to defeat, but it is not a true victory because we have ascribed viewpoints that the opponent does not really hold. The reality is that people that identify with an opposing group often have worthwhile points, and they are rarely as idiotic as they are made out to be either in our minds or our conversation.

Corruption, deception, and ignorance admittedly run rampant among politicians and their constituents. But when you listen to or talk to others about politics, try to keep in mind what effect some of those seemingly benign labels have, and remember that just because they call themselves something else doesn’t automatically mean they are less than you in any way.

Memorial Day and Just War Principles

No Gravatar

In light of the fact that Monday is Memorial Day, and with people’s thoughts being directed towards those who have died fighting in wars, I propose a thought experiment about the idea of a Just War. I directly lifted the following summaries of Just War ideas from Wikipedia, because they seem clear enough:

Jus ad bellum (Right to Wage War)

  1. Just cause: The reason for going to war needs to be just and cannot therefore be solely for recapturing things taken or punishing people who have done wrong; innocent life must be in imminent danger and intervention must be to protect life. A contemporary view of just cause was expressed in 1993 when the US Catholic Conference said: “Force may be used only to correct a grave, public evil, i.e., aggression or massive violation of the basic human rights of whole populations.”
  2. Comparative justice: While there may be rights and wrongs on all sides of a conflict, to override the presumption against the use of force, the injustice suffered by one party must significantly outweigh that suffered by the other. Some theorists such as Brian Orend omit this term, seeing it as fertile ground for exploitation by bellicose regimes.
  3. Legitimate authority: Only duly constituted public authorities may wage war.
  4. Right intention: Force may be used only in a truly just cause and solely for that purpose—correcting a suffered wrong is considered a right intention, while material gain or maintaining economies is not.
  5. Probability of success: Arms may not be used in a futile cause or in a case where disproportionate measures are required to achieve success.
  6. Last resort: Force may be used only after all peaceful and viable alternatives have been seriously tried and exhausted or are clearly not practical. It may be clear that the other side is using negotiations as a delaying tactic and will not make meaningful concessions.
  7. Proportionality: The anticipated benefits of waging a war must be proportionate to its expected evils or harms. This principle is also known as the principle of macro-proportionality, so as to distinguish it from the jus in bello principle of proportionality.

Jus in bello (Conduct During Wars)

  1. Distinction: Just war conduct should be governed by the principle of distinction. The acts of war should be directed towards enemy combatants, and not towards non-combatants caught in circumstances they did not create. The prohibited acts include bombing civilian residential areas that include no military target and committing acts of terrorism or reprisal against civilians.
  2. Proportionality: Just war conduct should be governed by the principle of proportionality. An attack cannot be launched on a military objective in the knowledge that the incidental civilian injuries would be clearly excessive in relation to the anticipated military advantage (principle of proportionality).
  3. Military necessity: Just war conduct should be governed by the principle of minimum force. An attack or action must be intended to help in the military defeat of the enemy, it must be an attack on a military objective, and the harm caused to civilians or civilian property must be proportional and not excessive in relation to the concrete and direct military advantage anticipated. This principle is meant to limit excessive and unnecessary death and destruction.

Jus post bellum (Ending a War)

  1. Just cause for termination: A state may terminate a war if there has been a reasonable vindication of the rights that were violated in the first place, and if the aggressor is willing to negotiate the terms of surrender. These terms of surrender include a formal apology, compensations, war crimes trials and perhaps rehabilitation. Alternatively, a state may end a war if it becomes clear that any just goals of the war cannot be reached at all or cannot be reached without using excessive force.
  2. Right intention: A state must only terminate a war under the conditions agreed upon in the above criteria. Revenge is not permitted. The victor state must also be willing to apply the same level of objectivity and investigation into any war crimes its armed forces may have committed.
  3. Public declaration and authority: The terms of peace must be made by a legitimate authority, and the terms must be accepted by a legitimate authority.
  4. Discrimination: The victor state is to differentiate between political and military leaders, and combatants and civilians. Punitive measures are to be limited to those directly responsible for the conflict. Truth and reconciliation may sometimes be more important than punishing war crimes.
  5. Proportionality: Any terms of surrender must be proportional to the rights that were initially violated. Draconian measures, absolutionist crusades and any attempt at denying the surrendered country the right to participate in the world community are not permitted.

You can read the full Wikipedia article if you like. Now, if you are interested, read the full timeline of U.S. military operations since the inception of the country. It’s quite a list, really.

Memorial Day was unofficially started not long after the end of the Civil War in 1845, though it wasn’t declared to be an official Federal holiday until 1967. In light of that, here is a list of the major U.S. military operations since then—this list is from the above linked Wikipedia article, but I have removed most of the “small” operations:

  • 1968 – Laos & Cambodia. U.S. starts secret bombing campaign against targets along the Ho Chi Minh trail in the sovereign nations of Cambodia and Laos. The bombings last at least two years.
  • 1982-1983 – Lebanon. On September 29, 1982, President Reagan reported the deployment of 1200 marines to serve in a temporary multinational force to facilitate the restoration of Lebanese government sovereignty. On September 29, 1983, Congress passed the Multinational Force in Lebanon Resolution (P.L. 98-119) authorizing the continued participation for eighteen months.
  • 1983 – Grenada. Citing the increased threat of Soviet and Cuban influence and noting the development of an international airport following a bloodless Grenada coup d’état and alignment with the Soviets and Cuba, the U.S. launches Operation Urgent Fury to invade the sovereign island nation of Grenada.
  • 1983-89 – Honduras. In July 1983 the United States undertook a series of exercises in Honduras that some believed might lead to conflict with Nicaragua. On March 25, 1986, unarmed US military helicopters and crewmen ferried Honduran troops to the Nicaraguan border to repel Nicaraguan troops.
  • 1983 – Chad. On August 8, 1983, President Reagan reported the deployment of two AWACS electronic surveillance planes and eight F-15 fighter planes and ground logistical support forces to assist Chad against Libyan and rebel forces.
  • 1987-88 – Persian Gulf. After the Iran-Iraq War resulted in several military incidents in the Persian Gulf, the United States increased US joint military forces operations in the Persian Gulf and adopted a policy of reflagging and escorting Kuwaiti oil tankers through the Persian Gulf, called Operation Earnest Will. President Reagan reported that US ships had been fired upon or struck mines or taken other military action on September 21 (Iran Ajr), October 8, and October 19, 1987 and April 18 (Operation Praying Mantis), July 3, and July 14, 1988. The United States gradually reduced its forces after a cease-fire between Iran and Iraq on August 20, 1988. It was the largest naval convoy operation since World War II.
  • 1989-90 – Operation Just Cause, Panama – On December 21, 1989, President Bush reported that he had ordered US military forces to Panama to protect the lives of American citizens and bring General Noriega to justice. By February 13, 1990, all the invasion forces had been withdrawn. Around 200 Panamanian civilians were reported killed. The Panamanian head of state, General Manuel Noriega, was captured and brought to the U.S.
  • 1990 – Saudi Arabia. On August 9, 1990, President Bush reported that he had ordered the forward deployment of substantial elements of the US armed forces into the Persian Gulf region to help defend Saudi Arabia after the August 2 invasion of Kuwait by Iraq. On November 16, 1990, he reported the continued buildup of the forces to ensure an adequate offensive military option. American hostages being held in Iran.
  • 1991 – Operation Desert Shield and Operation Desert Storm (Persian Gulf War). On January 16, 1991, U.S. forces attacked Iraqi forces and military targets in Iraq and Kuwait in conjunction with a coalition of allies and under United Nations Security Council resolutions. Combat operations ended on February 28, 1991.
  • 1991 – Iraq. On May 17, 1991, President Bush stated that the Iraqi repression of the Kurdish people had necessitated a limited introduction of U.S. forces into northern Iraq for emergency relief purposes.
  • 1992 – Kuwait. On August 3, 1992, the United States began a series of military exercises in Kuwait, following Iraqi refusal to recognize a new border drawn up by the United Nations and refusal to cooperate with UN inspection teams.
  • 1992-2003 – Iraq. Iraqi No-Fly Zones The U.S. together with the United Kingdom declares and enforces “no fly zones” over the majority of sovereign Iraqi airspace, prohibiting Iraqi flights in zones in southern Iraq and northern Iraq, and conducting aerial reconnaissance and bombings. (See also Operation Southern Watch)
  • 1992-95 – Somalia. “Operation Restore Hope” Somali Civil War On December 10, 1992, President Bush reported that he had deployed US armed forces to Somalia in response to a humanitarian crisis and a UN Security Council Resolution. The operation came to an end on May 4, 1993. US forces continued to participate in the successor United Nations Operation in Somalia (UNOSOM II). (See also Battle of Mogadishu)
  • 1993–Present – Bosnia-Herzegovina.
  • 1993 – Macedonia. On July 9, 1993, President Clinton reported the deployment of 350 US soldiers to the Republic of Macedonia to participate in the UN Protection Force to help maintain stability in the area of former Yugoslavia.
  • 1994-95 – Operation Uphold Democracy, Haiti. U.S. ships had begun embargo against Haiti. Up to 20,000 US military troops were later deployed to Haiti.
  • 1995 – Operation Deliberate Force, Bosnia. NATO bombing of Bosnian Serbs.
  • 1998 – Operation Desert Fox, Iraq – U.S. and British forces conduct a major four-day bombing campaign from December 16–19, 1998 on Iraqi targets.
  • 1998 – Operation Infinite Reach, Afghanistan and Sudan. On August 20, air strikes were used against two suspected terrorist training camps in Afghanistan and a suspected chemical factory in Sudan.
  • 1999-2001 East Timor. Limited number of U.S. military forces deployed with the United Nations-mandated International Force for East Timor restore peace to East Timor.
  • 1999 – Operation Allied Force – NATO’s bombing of Serbia in the Kosovo Conflict.
  • 2001 – Afghanistan. War in Afghanistan. The War on Terrorism begins with Operation Enduring Freedom. On October 7, 2001, US Armed Forces invade Afghanistan in response to the 9/11 attacks and “begin combat action in Afghanistan against Al Qaeda terrorists and their Taliban supporters.”
  • 2003 – 2003 invasion of Iraq leading to the War in Iraq. March 20, 2003. The United States leads a coalition that includes Britain, Australia and Spain to invade Iraq with the stated goal of eliminating Iraqi weapons of mass destruction and undermining Saddam Hussein.
  • 2004 – War on Terrorism: US anti-terror related activities were underway in Georgia, Djibouti, Kenya, Ethiopia, Yemen, and Eritrea.
  • 2006 – Pakistan. 17 people including known Al Qaeda bomb maker and chemical weapons expert Midhat Mursi, were killed in an American MQ-1 Predator airstrike on Damadola (Pakistan), near the Afghan border.[9][10] However, statements by U.S. and Pakistani officials reported in September, 2007 disclosed that that none of those al-Qaeda leaders perished in the strike and that only local villagers were killed.
  • 2009 – Pakistan, In relation to efforts in Afghanistan, U.S. Forces struck an insurgent encampment in the Northern mountains, killing 24, with missiles fired from an unmanned aerial assault vehicle.

What on earth have we been up to? And, much more importantly, why? Answering those questions could take more than a lifetime, so I won’t really try right now. But think about Just War principles, and think about the wars or individual battles that you might actually know something about. Do the principles line up with history? How many things have we done that we had no business doing?

Or, to put it another way:

  • Is the idea of a “just war” as describe above missing any principles?
  • Are any of the existing principles incorrect?
  • Can you think of a war that you consider “just” that wouldn’t be classified that way by the above ideas?

Spend some time answering those questions, and you might have a more pensive Memorial Day amidst all the barbecues and such.

Solving Mastermind Logically

Mastermind Game
No Gravatar

Many of you know that I love logic puzzles, and that artificial intelligence fascinates me. These two interests go hand-in-hand, and both are complemented by my passion for programming. I have at various times tried to write programs to either generate or solve different kinds of logic puzzles, including tic-tac-toe, Sudoku, Lights Out, and Mastermind. I even wrote some notes about the expected value of a Yahtzee game (while taking a statistics class) as part of an effort to pit two “smart” computer players against each other in Yahtzee—though that had more to do at the time with statistics than artificial intelligence, so I digress.

Sadly, many of my efforts never generated full working solutions, but I sure did have fun trying. The interesting thing about implementing any kind of artificial intelligence, even very simple machines, is that it is usually far easier to explain how it should work to another person than it is to make the computer behave correctly. This is a testament to the incredible computing power our brains actually possess, but it also poses a challenge that I love trying to overcome, even just for the sake of it. So today, I’ve decided to write out my simple explanation for solving Mastermind, which will hopefully prompt me to finish writing my solution.

Mastermind is a relatively simple logic game. (Side note: wow, that Wikipedia link just gave me a bunch of ideas, particularly because of Knuth’s five-guess algorithm. That dude is a genius.) The game seems intimidating to some people, but it is really far easier than almost any game I can think of. This is because there are no time limits and only two rules:

1. A black peg means you have a correct color in the right place.
2. A white peg means you have a correct color in the wrong place.

That’s all there is to it. All you need to do is choose pegs that do not violate any of those rules for any of your guesses so far. Everything else is random (ignoring the optimizations possible with Knuth’s five-guess algorithm, or the six-guess one also from the article). In order to play the game, you need to follow only two steps:

1. Choose random colors for pegs that you assume to be wrong.
2. Arrange your current guess in a way that doesn’t violate either of the rules above.

As long as you don’t have any guesses that don’t fit with the “grade” pegs you get from any previous guesses, then you will solve the puzzle in a perfectly logical fashion. It may not be the optimal solution, but it is certainly logical. Try a quick online version here if you want to try it out.

The problem with writing a program to actually solve a puzzle is making the program intelligently follow those two steps above, particularly #2 (step #1, choosing new random colors, is usually really easy). Depending on which language you choose to write your solver in, it could be more or less complicated. The logic is the same, but some languages really lend themselves to that kind of coding. The absolute best language I know of is Prolog, because it has a built-in logic engine. I can’t imagine how it works behind the scenes, but it’s incredibly capable. There is an elegant Prolog Mastermind solver here if you want to check it out.

I had a Prolog class in college, which was fascinating bun sadly not enough to make me confident enough to try writing a program of that complexity, even though it’s probably not that complex as Prolog programs go. I’d love to learn more about the language, and Mastermind would be a great exercise, but I want to use a language I’m familiar with. For me, that means C/C++ or PHP. I’ll probably go with PHP, because I don’t care for speed (yet) and I have to deal with multidimensional arrays, which are way easier with PHP.

Programmatically, to make sure any guess doesn’t disagree with any previous set of grade pegs, you need to track the information given by each grade. Each grade gives you two categories of information:

1. Which color/position arrangements are possible
2. Which color sets are impossible

These two types of information are recorded and used very differently. Each graded guess will give you a different set of information for each category, and the quantity of information available depends on how many black and white grade pegs you get. For example, say you have a puzzle whose solution is:

…and your guess is:

The red is the right color in the right place, and the blue is the right color in the wrong place, and the last two are simply wrong colors. Therefore, that guess would receive a grade of 1 black and 1 white peg. What exactly does this tell you? Well, in simple terms, it tells you part of what we already know: you have one right color in the right place, and another right color in the wrong place. However, since you hypothetically don’t know the solution yet, that grade doesn’t tell you which of your guess positions the grade pegs apply to. So, from the computer’s perspective, that grade tells you exactly this:

  1. Possible color combinations: (based on 1 black, 1 white)
    1. #1=Red, #3=Blue
    2. #1=Red, #4=Blue
    3. #2=Blue, #3=Red
    4. #2=Blue, #4=Blue
  2. Impossible color sets: (based on 2 grade pegs)
    1. Red, Blue, Black
    2. Red, Blue, Orange
    3. Blue, Black, Orange
    4. Red, Blue, Black, Orange

This is not that difficult to determine automatically. If you work out the possibilities manually though, it can definitely be a pain. You might also discover that a grade of exactly two white pegs is the least helpful grade you can possibly get, since all you know is that two of the four colors are in the wrong place. This is less helpful than exactly one white peg (which tells you that three pegs aren’t in the solution at all), and exactly three white pegs (which tells you that three of the pegs are in the solution).

The key is to take each of these sets of information and run new guesses through them like filters. Each potential new guess must fit with all previously gathered information, or it must be tossed out. If it fits, then it’s logical, and you can proceed to get a new grade.

A program to solve a Mastermind puzzle has to repeat this process over and over until it finds the solution. It doesn’t seem so bad explained like this, but all (both) of my previous attempts at an implementation failed. One of them came really close, but something about it wasn’t quite right. Maybe the publication of this post and my renewed interest will encourage me enough to fix it and finish, so I can post something more concrete for you all, like an actual solver that you can run online.

On a separate note, those of you paying any attention at all probably noticed that my blog layout changed again. I really like the old one (a very dark theme with light text), but as nice as it looked, it was kind of hard to read because of the contrast. I may try to fix it and maintain much of the old theme, but for now, I like this new one enough to keep it.