A quick Introduction to Logic Programming
Do you struggle to understand the idea of Logic Programming? Here's a simple explanation.
When developers or scientist want computers to act a certain way, they often times communicate to the system in a language that can somewhat be implemented by the computer's processor. These languages, owing to how they're structured and written can be classified into various paradigms - imperative, functional, declarative or Object-oriented.
My focus on this article will seek to explore Logic Programming, a declarative language usually employed in the areas of Artificial intelligence and database, areas with high definitions and constraints.
The term logic is defined as the science of reasoning. It encompasses a set of principles to evaluate the validity of an argument; classifying it as either being true or false.
Programming, is basically the process of writing a series of instructions in a designated language for the computer to perform a specific task. Which can range from simple exercises like looping through a set of items, changing the style of a set of characters, to complex computations such as system simulation, and building functional software applications.
While these two concepts may be separate and vast in their study and application, Logic Programming combines both —to write and structure codes in a manner that abstracts the programmer from the procedural implementation of the whole program. The declarative nature of this kind of programs makes it direct and succinct to write by employing First order logic and various logical rules to develop algorithms that makes computation, Implementation and writing in this language less complicating. Hence, Logic Programming specifies the goals of the program, while, how the the program should be processed is shouldered by the system.
Some Important rules in Logic Programming:
3. Unification
In simpler terms, declarative languages like logic programming tells the computer what it wants without describing how. However, even though these languages do not detail how the instruction should be implemented, the machine level processing of these programs are mainly procedural in nature.
Abstract
if you ask a professional chef who has known your routine for a relatively long time to make you a plate of pasta, you won't bother emphasizing on how spicy or how warm you'd like your meal to be. Some how, from experience, you just know you'll be given what you ordered. Though you only asked for a plate of pasta, the chef however, goes through a series of steps like chopping the vegetables, stiring, seasoning and heating sequentially to prepare your food. At the surface, you ordered a meal and was served. At the background, the preparation was a step by step process. This is exactly how Logic Programming works. Thank you for stopping by.