# LOGIC PROGRAMMING

## Introduction to reasoning

By SHD TECHPublished about a year ago 15 min read
9

1. Introduction

The term reasoning can be understood in many ways: drawing conclusions, solving problems, making inferences, etc. Obviously, there are many approaches to drawing conclusions or making inferences. Some of the reasoning approaches may not provide strong or valid conclusions all the time. For example, scientific reasoning appears to be strong but it can be falsified with the emergence of new scientific theories. In contrast, mathematical reasoning always preserves the truth. There are several other approaches to reasoning. This article discusses various approaches to reasoning with a particular emphasis on what is called deductive reasoning. This is because; of the concept of Logic Programming.

1.1 What is reasoning?

In a reasoning process, we start from what is known and look for a conclusion.Reasoning is such a fundamental task, which applies to everything including the identification of a smell, colour, sound, etc. When we go through a list of names and identify a certain name it is also a reasoning process. In this case, we apply a very simple reasoning technique, which is called search and match. Furthermore, having solved a large number of questions, one can solve a given similar problem through the reasoning strategy that is known as case-base reasoning. That is why we do so many tutorials and past papers (When preparing for an examination). Case-based reasoning is also a popular reasoning strategy used by medical doctors to diagnose diseases. Scientists discover new theories and prove the validity of those theories through the results obtained from a large number of experiments. In that sense, undoubtedly, the reasoning is a fundamental task in almost all real-world scenarios. Why reasoning? We all have collections of knowledge in our brains. We always explore these collections of knowledge to draw various conclusions. If we do not know how we can explore the knowledge we have, there will not be any use for such knowledge. Exploring the available knowledge to see what can be concluded from the knowledge is actually reasoning. How we explore the available knowledge is dependent on the nature of knowledge. For example, we solve a mathematical equation, which is a form of knowledge, through a step-by-step deductive reasoning process. In contrast, in science, we need a large number of evidence to draw a conclusion. For instance, Paracetamol has been concluded as a pain killer because it had worked as a pain killer for thousands of people. However, just because 99 students solve a mathematical problem in one manner, it cannot be concluded that the solution is correct. Perhaps, one student may be correct. Therefore, the validity of a solution to a mathematical problem cannot be obtained by the use of the reasoning strategy applied in science. Therefore, the choice of the appropriate reasoning technique is dependent on the nature of the knowledge at hand. The choice of the inappropriate reasoning technique may result in a wrong or invalid conclusion.

EX 1.1

Suppose you have never cooked and one day your mother asked you to do some cooking. When preparing a curry explain which reasoning techniques you may use to decide on putting different items and the time at which you do so.

Common sense, trail and error, etc.

1.1 Types of reasoning

As already stated, there are various types of reasoning techniques. This section critically discusses those reasoning techniques to identify their advantages and disadvantages. In particular, we point out whether each reasoning approach preserves the truth in its conclusion. Among other reasoning techniques, the following are frequently discussed in the literature. Now we briefly discuss the nature of these reasoning techniques.

• Deterministic reasoning

• Dynamic Reasoning

• Non-deterministic reasoning

• Search and match

• Deductive reasoning

• Abductive reasoning

• Inductive reasoning

• Case-based reasoning

• Analogical reasoning

• Model-based reasoning.

1.1.1 Deterministic reasoning

The word deterministic has a similar meaning to exact. As such, deterministic reasoning returns exactly ONE answer as the conclusion for a given situation. Deterministic reasoning is based on Aristotle’s Classical Logic deals with only two truth values: true or false. According to this logic, a given statement is either true or false, but it cannot be true and false at the same time. Many subjects including Mathematics, Science and Law have used deterministic reasoning to generate explicit conclusions for real-world problem-solving. In layman’s terms, deterministic reasoning can also be named as logical reasoning. However, this expression is rather incomplete, because there are so many systems of logic (e.g. classical logic, fuzzy logic, modal logic, intentional logic, etc) that may not return exactly one value as the conclusion.

1.1.2 Dynamic Reasoning

Dynamic reasoning is used to draw conclusions in situations where we have incomplete and inconsistent information. This information may vary from time to time. In dynamic reasoning, there is a particular reasoning technique as in logic. However, at a given moment one can use classical logic to draw conclusions in dynamic reasoning too. Here is a well-known example, requiring dynamic reasoning and the use of classical logic for dynamic reasoning. We are given that “birds can fly” is true and “Tweety is a bird”. With this current information, we conclude that Tweety can fly. Now assume that we are given additional information, “Tweety is a penguin” and “penguin cannot fly”. In view of the new information, now we conclude that Tweety cannot fly. It appears that dynamic reasoning is very much required in real-world problem solving because the entire world is uncertain and ever-changing.

1.1.3 Non-deterministic reasoning

Non-deterministic reasoning stands for drawing conclusions by giving more than one answer. For example, the sentence: “When the price of 1kg of rice is Rs. 100/=, it can be considered as rice is expensive”. This can be concluded as a true statement by some people. Some other people say that this is false. Another person might say that the statement is closer to the truth, but it is not exactly true. Here the answer is between true and false. Non-deterministic reasoning is a hot topic in fields like Artificial Intelligence. This particular type of reasoning generally cannot be handled by Aristotle’s classical logic which talks about exactly one truth value for a given expression. A special kind of logic called, Fuzzy Logic has been a powerful system of logic for handling non-deterministic reasoning.

1.1.4 Search and match

Search and match is a very common reasoning strategy for drawing conclusions. For instance, when we want to find the result of a particular student from a list, we search and match his name in the list and find the corresponding result. Although this reasoning technique appears to be very familiar, the search is such a complex task when the search spaces are large and also have many possibilities. The field of Artificial Intelligence has a long-established separate branch called Search algorithms that explore solutions from a complex search space.

1.1.5 Deductive reasoning

Deductive reasoning stands for drawing conclusions on the basis of a given set of true statements, named as premises. In deductive reasoning, premises (known true statements) are explored by using Aristotle’s classical logic. a most attractive feature of deductive reasoning is that it preserves the truth. In other words, the conclusions drawn from deductive reasoning are always true. Mathematics is one of the major areas that use logic to draw conclusions from the premises. For example, we simply the 2+3+0 as 2+3, knowing the premise 3+0 is 3 in real numbers. Mathematical theorem proving is necessarily powered by the use of deductive reasoning through classical logic. Due to truth -preserving the nature of deductive reasoning, people say that mathematics always develops on older theories and older theories can never be disproved. Deductive reasoning has also been used in areas like law and modern science to ensure preserving the truth in their conclusion. It should be noted that deductive reasoning needs not match real -world experiences, though it preserves the truth. For example; “Elephants are vegetarian” is a true statement, while “Computers are machines” is also true. According to deductive reasoning, the conjunction (and) of true statements must also be true. Therefore, we conclude that “Elephants are vegetarian and Computers are Machines” also true. But this does not make sense as a sentence in the real world. Further, given that

“if the baby is dead then baby does not cry” and if the baby does not cry then the mother is happy”,

deductive reasoning concludes that “if the baby is dead then the mother is happy”. Of course, this again does not match our real-world experience. Note that matching the conclusions with the real world is not a concern of deductive reasoning. It primarily talks about how to draw logically valid conclusions from premises. We discuss more deductive reasoning toward the end of the lesson with an emphasis on deductive reasoning for the computing world.

1.1.6 Abductive reasoning

Abductive reasoning is the converse of deductive reasoning. This means knowing a conclusion and trying to establish the premise(s). For example, if you have dengue fever then you have red patches. Here the premise is ‘you have dengue’, while ‘you have red patches’ is the conclusion. Using deductive reasoning, knowing that you have dengue fever we conclude that you have red patches. In contrast, knowing that you have red patches, abductive reasoning concludes that you have dengue fever. Obviously, the abductuve reasoning may not be true. Because knowing that ‘you have red patches’ there can be many premises other than dengue fever. So it does not preserve the truth. In fact, in Mathematics for IT, you studied that P→ Q is not equivalent to Q→P.

However, it should be noted that abductive reasoning is of great importance to finding facts for establishing a deductive conclusion. Suppose we know that

“if the battery is good, the starter motor is good, spark plugs are good and fuel is in in the tank then a car should start”.

Now in order to find out why the car does not start, we begin with the conclusion part and check for premises one by one. That means: the battery, motor, plugs, etc. are checked. It is clear that abductive reasoning is applied in medical diagnosis too, because the doctor suspects a disease and recommends various tests for establishing premises. Having received the reports, the doctor logically analyses the report (deductive reasoning) and come to a conclusion.

1.1.7 Inductive reasoning

Inductive reasoning uses a large number of evidence or observations for drawing a conclusion. For example, having given Panadol to many patients, scientists have noticed that it works as a pain killer. Therefore, it is concluded that Panadol is a pain killer. It is a well-known fact that Scientific conclusions are drawn on the basis of a large number of results obtained from carefully set out experiments. This is why inductive reasoning is considered a key reasoning strategy in modern science. The greatest strength of inductive reasoning is that it uses a large number of evidence to draw a conclusion. In contrast, inductive reasoning does not preserve the truth or its conclusions are always not true. For instance, tomorrow one can find evidence to say that Panadol is not a pain killer and instead it does some damage to the brain. All new theories in science come forward by disproving the already accepted theories. This is how Newtonian theory was falsified and Einstein's theory of Relativity came forward. Today, there is enough evidence to prove inductively that Einstein's theory is valid. But in the future, with the presence of new evidence, this will also be falsified.

1.1.8 Case-based reasoning

Cases are structured evidence to draw conclusions. For example, a loan application is a kind of case, and we can analyse several such applications to decide on what to do with a new application. Further, we are familiar with the term court case. In the court of law, lawyers argue on the basis of previous cases and judges come to a conclusion as per the cases presented. For instance, if we know a case; fine for driving without a license is Rs. 1000/=, we may use case-based reasoning to conclude that the fine for driving without insurance may also be closer to Rs. 1000/=.

In case-based reasoning, it is essential to match against the appropriate cases. Otherwise, the conclusion may not be relevant. For example, a case of driving without a license cannot be compared with a murder case to decide on the punishment for killing a person. In general, we must select cases from the same domain (area) for applying case-based reasoning. For instance, in order to diagnose the fault of a certain television you may consider a case of similar television but not a case of a radio or a bicycle. Case-based reasoning can go with other reasoning techniques too. For example, if you can find a large number of cases that support the new case, inductive reasoning can be used together with case-based reasoning to draw a conclusion. Sometimes, even when you have just a few cases, deductive the reasoning may help to draw a conclusion in a logical manner.

1.1.9 Analogical reasoning

Analogical reasoning is somewhat similar to case-based reasoning. However, in analogical reasoning, you do not need to consider the cases or examples from the same domain. For instance, when we take the analogy that a computer is like a brain, obviously the brain and the computer are from different domains. Since analogical reasoning allows using examples across domains, this approach works very well in the real world. For instance, in order to describe an aircraft, to a person who knows about birds, we can use the analogy: an aircraft is like a bird. Further, to explain an aircraft to a person who knows about seagoing vessels, we can use the analogy: an aircraft is like a ship. Analogical reasoning helps draw conclusions not only in terms of similarities but also through dissimilarities. For example, when we say a car is like a bicycle, we can notice the difference between the number of seats of a car and a bicycle to conclude about the size of a car. Again, inductive and deductive reasoning can be used to strengthen the drawing of conclusions in case-based reasoning.

1.1.10 Model-based reasoning

Models are proven examples of describing something. They are stronger than cases or analogies. For example, Newtonian theory F=ma is called a model, which is proven through scientific experiments. All scientific models have the explanation power. As such, model-based reasoning provides not only conclusions but also reasons for such conclusions. It is a well-known fact that explanation ability is one of the key features of scientific theories. Obviously, conclusions (solutions) with justifications are more important than mere conclusions.

EX 1.2

Read the following paragraph and identify which reasoning techniques could be used at which point. Road accidents in Sri Lanka have gone up over the last 10 years. According to RMV reports, the number of vehicles introduced to the roads has also increased day by day. Many people complain that accidents are due to the unethical behaviour of drivers. Drivers say that road conditions are so poor and this leads to an increase in the rate of accidents and also sends the vehicle condition down. If the road condition is so crucial all types of drivers must be affected, but accidents are generally caused by private bus divers. Therefore, drivers’ unethical behaviour is more relevant than road conditions for the increase of accidents. There is also evidence to say that even if you drive carefully, you are not safe because drivers of other vehicles are unethical.

Inductive: Many people complain that accidents are due to the unethical behaviour of drivers. Drivers say that road conditions are so poor and this leads to an increase in the rate of accidents and also sends the vehicle condition down.

Deductive: If the road condition is so crucial all types of drivers must be affected, but accidents are generally caused bus private bus divers. Therefore, drivers’ unethical behaviour is more relevant than road conditions for the increase of accidents.

Case-based: There is also evidence to say that even if you drive carefully, you are not safe because drivers of other vehicles are unethical.

1.2 More on Deductive reasoning

Section 1.1 presented various techniques for reasoning. It appears that inductive reasoning and deductive reasoning are fundamental to other reasoning techniques too. In particular, inductive reasoning has powered scientific conclusions, while deductive reasoning is the key technique for drawing truth-preserving conclusions.As such deductive reasoning has been used in many areas including mathematics, science, computing, etc. In the computing world, Deductive Databases are some of the best examples of the application of deductive reasoning for drawing conclusions from huge databases. Further, deductive reasoning has been used in expert systems like areas in Artificial Intelligence. It should be noted that people are fascinated by logic-based (deductive) reasoning for at least due to two reasons:

(i) logic can explicitly represent knowledge

(ii) logic has an elegant mechanism to do reasoning

The use of logic as the building block of developing a paradigm for programming has emerged as the area of Logic programming. Logic programming is yet another revolutionary application of logic for computing. It should be noted that Logic Programming does not mean coding logically valid programs. The Logical validity of a program should anyway be with all programming traditions. In Logic Programming, programs are written as collection predicate logic (first-order logic) expressions. More importantly, the compilers of logic programming environments execute the programs according to the procedure used to draw conclusions in logical reasoning.

1.3 Summary

This Lesson discussed various reasoning techniques. It was realised that deductive and inductive reasoning is fundamental to almost all other reasoning techniques. It was recognised that deductive reasoning is considered to be more powerful than other reasoning techniques due to truth preserving the nature of its conclusions. Deductive reasoning is powered by classical logic. We pointed out that various areas including mathematics, science and court of law have used logic-based deductive reasoning for drawing conclusions that preserve the truth. This course is about the use of logic for developing a radically different programming paradigm. From Lesson 02 onwards you will learn about First order logic (predicate logic) and its use for Logic Programing in Prolog language.

teacherstudenthigh schooldegreecoursescollege
9

## About the Creator

### SHD TECH

How does it work?

• Azka Lameekabout a year ago

Good information

• Fathima Azhaabout a year ago

Nice