Posts Tagged ‘logic’

How to spot an obvious idea when you’ve got one

Wednesday, April 1st, 2009

I did say, and I quote:

Now, somebody has probably already done this, but I’ll throw in my twopenneth anyway.

with respect to finding analytical function for the logic gates. But, lo and behold, I’m the top result in Google for it, and no-one else seems to have thought of exploring this before.

So maybe it’s not so obvious as I thought.

Logic 2.1.1

Tuesday, March 24th, 2009

Further discussion on the logic functions with my good friend Matt, specifically regarding what they could mean, has landed on the idea that a value of, say, 2 or 3 for the truth of a statement X could equate to “X is sooooo true”.

Bearing this in mind, Matt wasn’t happy with the shape of the graph of =>, and further thought has led to the following necessary conditions for a function =>(x,y) (I’ll call it f from now on for ease of typing) which works well with the notion that something can be soooo true:

  • f(x,1) –> 0.5 as x –> infinityx (so if something very true implies something else is true to a normal level, this means the implication is less a preserver of truth: more a diluter (though I set the asymptote as 0.5 as we thought it shouldn’t get closer to falsity than to truth)
  • f(x,0) < 0 for all x > 1 (if x gets more true but y is still not true, then teh implication is, again, less of a truth preserver, though this is debatable. Maybe eqality with zero would be more appropriate.)
  • f(1,y) –> infinity as y –> infinty (similar to the case where x varies and y = 1,  if 1 is immensely true despite x only being a little bit true then the implication is very strongly true)
  • f(0,y) = 1/y for all y > 1 (the thinking here being that if y contiinues to get more and more true, despite no change in x, then the link between y and x should accordingly be weakened)

logic 2.1

Monday, March 23rd, 2009

I have, as promised, found a better form for XOR:

  • XOR(x,y) = x + y -2xy

As I sit here chomping on a chicken wing, I can’t help but feel a touch of disappointment alongside the inevitable satisfaction at completing my mission. The previous solution – XOR(x.y) = (1-xy)(x + y) – was, I feel, more elegabt; the fact we were dealing with x/y symmetry, and that x and y could take only the values 1 and 0, seemed to almost leap out.

Talking of symmetry – I’ve just realised that I didn’t cover x => y, the only asymmetric elemental* logical operator.

So here, deduced by trial and error is the formula:

  • =>(x,y) = xy + 1 – x

I lied though. Because, of course, => is not as elemental as one would hope, so:

x => y <–> NOT (x AND NOT(y)) = NOT(x AND (1-y)) = NOT(x(1-y)) = 1-(x-xy) = xy +1 -x

Thus demonstrating the usefulness of being able to represent logical operators analytically.

Logic 2.0

Saturday, March 21st, 2009

Now, somebody has probably already done this, but I’ll throw in my twopenneth anyway.

Yesterday morning I woke feeling strangely alert, so decided to do some maths. Namely, finding analytical functions of the real numbers taht agree with the logical operators NOT, AND, OR and XOR on the values of 0 and 1, and here they are:

  • NOT(x) = 1-x
  • AND(x,y) = xy
  • OR(x,y) = 1-(x-1)(y-1)
  • XOR(x,y) = (1-xy)(x+y)

Now, the above begs a few questions

  1. Are they any use? Well, I think so. They can be combined and recombined to form an polynomial function LP: {1,0}^n —> {1,0} to represent any logical proposition, where n is the number of elementary propositions. So given the truth or falsity of all these propositions the truth or falsity of the compound statement can easily be deduced
  2. Are these the simplest analytical functions that agree with the logical operators on 1 and 0? Probably NOT, OR and AND are; they’re all quadratic or less. But XOR is a cubic expression, which is unexpected. I can’t help thinking a hyberbolic parabola – quadratic – with the relevant constants shoudl work. Will have a think. *edit – success!
  3. Can they be extended over the reals? Well, yes – they’re analytical! But a good question is ‘What is the real world interpretation of a function like this?’ Extending the factorial function over the reals has proved useful, but would extending logic to things being doubly true, trebly true, negatively true, make any sense? Search me. The functions above could withstand the insertion of a few square/cube roots here and there, thus making the graphs more linear, and maybe they would be more likely to lend themselves to a real world interpretation. But the shapes of the graphs for the non-rooted functions (and probably ones with roots taken) (see below) defy interpretation I think.
  4. What do these functions look like?