May 28, 2009

Mathematical Intuitionism and the project

I don't really know what im talking about, but ...

It occurred to me that my project does not use negation as failure, and also doesn't use the law of excluded middle. Its not like Im purposely trying to go against what would be normal, I only did what I thought made sense when writing. This just goes to show how much creatively there is in ignorance.

Im not trying to view this projects as something mathematically concrete. I don't really refer to anything as a "Model". My reasoning for the ternary model was that any proposition exists in one of THREE states with respect to a body of knowledge, that it either is confirmed, denied, or bears no relation. It looks like ive somehow stumbled into being a mathematical intuitionist though.

Funny how the wikipedia article, which is my only source of info on this area, doesn't mention anything about ternary logic, or modal logic (my ternary logic is really just a cheap substitute for modal logic after all).

At any rate this intuitionism appeals to me on some really sort of zen level. Maybe God can separate out all logical statements into True, and False. We however can't and it leads me to be very unsettled. I don't think ive ever written a nonconstructive proof in college. Now I don't feel safe in saying that anything thats not false is true.

Open Source Board Games

Earlier I talked about making Monopoly "open sourced" and how such an important piece of American culture should be owned by the culture. Now Im wondering how to do this for Settlers of Catan, a really fun and unique board game I just learned about. This game too, seems a bit overdone, but nowhere nearly as bad as monopoly. Making a game free from its manufactured nature often requires reducing the complexity of the game in several ways and just trusting the natural shape of the game to produce interesting situations. Ive been having some luck with a version Im trying with a deck of cards as the board.

May 11, 2009

Logic Unification in Trinary Logic

Im still workin on making the logic programming language of my dreams. Right now I have to get some sort of unification working, but Im using trinary logic so its been a bit of an adventure. Prolog doesn't have real negation so it really manages to sidestep alot of actual work. Informally in my logic system, called Llull, a statement has three possible truth states: 0 = No, 1 =Iono, 2 = Yes.

Yes and No are basically like True or False. Iono is much different. Since negation is allowed in Llull, determining wether a model implies something is an NP Hard problem. My unification isn't an exhaustive search, therefore, for hard problems, Llull will just throw its hands up in the air and say "iono and i don't care to actually figure it out". Iono means that either theres no data about the thing you asked about, or that it just can't find it.

Anyway, traditionally And, Or, and Not have been defined for trinary as:

  • And(s1,s2) = min(s1,s2)
  • Or(s1,s2) = max(s1,s2)
  • Not(1) = 1
  • Not(0) = 2
  • Not(2) = 0

If you check, these definitions make tons of sense. But to see why they really arent sufficent for my purposes maybe I should cover my unification algorithm. My unification algorithm works by breaking up statements in this manner (where s1, s2, s3 are all Llull statements) :
  • s1 -> And(s2, s3) if And(s1->s3, s2 ->s3)
  • s1 -> Or(s2, s3) if Or( s1->s3, s2->s3)
  • s1 -> Not(s3) if Not(s1->s3)

Rough Example:

Sean is a CS/Math Major -> Sean Studies CS And Sean Studies Math
iff
Sean is a CS/MathMajor -> Sean Studies CS And Sean is a CS/Math Major -> Sean Studies Math


Seeing this, it would be tempting to believe in rules such as:
  • And(s1, s2) -> s3 if Or(s1->s3, s1->s3)
This would be the case if we didnt' have Not, which is the source of all our No/0 values. But If we consider this case:

  • Suppose s1->s3 = 1. That is, Statement 1 doesn't tell us wether Statement 2 is True. Suppose s2 -> s3 = 0. That is, Statement 2 tells us that Statement 3 is False.
  • Our algorithm gives us the wrong answer. It gives 1 when it should give 0.
Clearly what is needed is a function like Or and one thats like And. I figured out what they should be and named the Or substitute Kind, the And substitute Cruel. I really don't know how the names came up in my head, they just did. They names just seem to fit well somehow.

Apr 21, 2009

Stupid projects

So I haven't been posting so i guess ill just take this opportunity to try to piece together some information about some of the projects i doing for my courses.

Project 1. Some sorta Model Checking/logic programming thingy:

Yea Im writing a logic programming "thingy" in python under the working title Llull. You don't have to tell me why this is stupid, I know how to do it in Ocaml or even more trivially in Prolog. The reason Im doing it in Python is im trying to make it significantly different from the norm and i need to be able to hack stuff on.

For example, right now it uses trinary logic: True, False, and IHaveNoDamnClue. If you ask Llull wether a statement is True it can return any of those. I don't claim to actually know prolog, but basically it doesn't have a real Not for a reason. The problem of model checking is NP hard, and my current implementation assumes you use Not in a pretty specific way. Sometimes IHaveNoDamnClue is returned when Llull is just too damn lazy to get to the truth(in special cases it actually returns false when it should return IHaveNoDamnClue, but ill fix this i swear). It uses unification after all.

Also, in accordance with past rants, the Logic in Llull uses thematic arguments, which Im pretty excited about. Thats the real reason for writing it in the first place.

As a side effect of working in Python the entire implementation is very object oriented in a very weired way. I currently just use Python's interactive programming environment to run it. Everything from Statements to Logic Connectors to the Environment are instances of objects. This has led to a number of weired situations where ive used functional code to Map arguments to functions which output Llull logic statements. And then i do logic programming with them. Needless to say im very amused.

Project 2. An Improper use of Neural Networks:

I basically just want to see how well neural networks could be used as deciders for simple context free grammars. Some grad student said i was stupid for trying, but they're never to be trusted. After all, they know too much. I haven't really started, and writing about this is kinda procrastinating but Id like just to test the idea out on well bracketed strings like: (()()(())).

I guess this is partially motivated by my fervent believe in the Chomsky faculty and that language is fundamentally context free. Another thing which grad students tell me im stupid for believing in. But again, what the hell do they know?

Mar 16, 2009

Just a crazy idea.

So i was thinking about pylog yesterday. I still haven't had time to really figure it out yet, but the idea of having bindings for a logic programming language really intrigues me. In particular I had an idea for an application for it.

Lets say i have a map class which is a 2d array of tiles, and each tile stores information about the map at the location: height, terrain, etc. I might have another class called cartographer which does stuff with the map class but unfortunately the cartographer and the tile class are interlinked. If i want the cartographer to give a certain tile a color, I would have to make a color field in the tile class.

Now obviously the solution is to have a space that can be written to in some notation (maybe xml,yaml) and then be reinterpreted by the cartographer class. This of course isn't done because its not practical and not a really common feature of any language i can think of.

But wouldn't it be really cool if these spaces for writing were actually little spaces of logic programming who all used common rules. Im not sure that this is the right encapsulation, but it would be fun.

ps. i need new hobbies for doing in class.

Mar 14, 2009

something i just thought about

Ive recently hit upon something about programming. There are two different kinds of objects that don't represent a data structure:
  • Generic objects with multiple possible meanings
  • Concrete objects with only one intended meaning
Integers, for example, can be used to represent lots of things, quantities, distances, speeds, and even the color of a pixel. Objects this basic aren't even really objects often, they don't need to be. The ability to correctly interpret the meaning of the variable is left to the programmer in the future. It is possible for example to add the number of apples on a tree to a persons height if the programmer decided to store those as ints (which they most likely would).

Most objects written by programmers have only one intended meaning. I could for example create a height class which would allow me to add heights and the embedded semantics of the operations would prevent me from adding height and apples together.

Whats interesting is creating classes of the first type and then being asked what the class is for.

Feb 26, 2009

There was a ladybug in my bedroom, living among the plants. I moved it to where I have moved all the plants and i hope its happy.

If I did the kinds of things I wish people did, I would have never gone to college.