Search code examples
logicartificial-intelligence

Logic aplications in artificial intelligence


I'm a computer engineering student but I've still never programmed in my life (I've only studied physics, operation research, math etc), but I'm studying on the side some logic (propositional, first order, fuzzy, and temporal logic). I've read that logic is used in artificial intelligence, but how exactly? Do you program, let's say, robots with programming logic or what?


Solution

  • Yes, we do. Basically robots are nothing more than wasted metal unless they are capable of doing something, which might include moving, perceiving the outside world and so on. This means that just like in the case of human beings, like yourself, there is information from the outside world for robots as well.

    You see, hear, touch, smell and taste things. That's how information of the outside world arrive into your nerve-system. Your brain has to process that information and convert impulses into thoughts.

    Something very similar happens in the case of robots. Let's imagine, as an example a robot dog, which has to move around and guard a given area.

    Now, that dog has to have an exact logical definition of what the area to protect is, which defines the domain of its job. Also, the dog has to perceive movement realtime (probably using a camera and sound sensors), heat sensors and chemical sensors would not hurt either. Now, with whatever sensors are applied to this robot dog, it perceives motion as event and has to differentiate in real-time the following types of motions:

    • hostile
    • friendly
    • irrelevant

    It has to apply logic in order to make this distinction and, if it happens to be hostile motion, then the dog has to guard the territory, so, if the motion is hostile outside the territory, the robot dog needs to keep attention of it. If the given motion is critically threatening, then the robot dog will have to guard itself, even outside the well defined domain of the job. If the hostile is inside the territory to protect, then the dog will have to act even if the motion is only slightly threatening.

    All this behavior requires logic and the only way we can apply logic to an otherwise inanimate object is by programming it. Generally we apply source-code in order to program such behaviors and, even though the source-code may be very abstract, at the end of the day it ends up to be machine code, which operates with numbers in binary base, specifically because the binary form of numbers consist of bits (digits which may be 1 or 0), so we can apply logic to anything.

    Even the electric circuits have logic gates, this is how we can program desired behavior.

    Naturally, the way we program is not the only possible way, we, human beings are also programmed by DNA, considering our attributes and even our inherent behavior. The fact that we develop a personality is only a layer above the finite set of our abilities.

    So, any behavior that we intend to achieve requires a definition. A definition requires logic. Logic can be programmed via electric circuits and/or source-code.

    Binary logic cannot be by-passed at this moment (unless one uses a quantum computer, but let's ignore that for now) at least at programming time. Naturally, Fuzzy logic can also be applied. Let's think about perceptrons and let's think of the example of a robot trying to read a text from the mosaic of pixels. The image might be blurry and the text might be at any angle, any size. Our robot still needs to read the text, so, it will need to differentiate A from H. What if it sees this:

    .            .    
    .             .
    .              .
    .               .
    .                .
    ...................
    .                  .
    .                  .
    .                  .
    .                  .
    .                  .
    

    Is it an H or an A? It's not a perfect H, nor a perfect A. It's somewhere between. So, our robot will need to see how far this letter is from A or H and choose the one which is closer. Now, our dog might sense image via a perceptron and will have to differentiate a robber from a parrot, for example. Fuzzy logic is applied to make sure that the dog robot gets it right. And then, in any case, logical processing is needed in order to ensure that the dog has the proper behavior whatever it perceives. We can apply logic to otherwise inanimate objects by programming them. So, if you want to define the behavior of robots, you might want to learn programming.