We are independent & ad-supported. We may earn a commission for purchases made through our links.
Advertiser Disclosure
Our website is an independent, advertising-supported platform. We provide our content free of charge to our readers, and to keep it that way, we rely on revenue generated through advertisements and affiliate partnerships. This means that when you click on certain links on our site and make a purchase, we may earn a commission. Learn more.
How We Make Money
We sustain our operations through affiliate commissions and advertising. If you click on an affiliate link and make a purchase, we may receive a commission from the merchant at no additional cost to you. We also display advertisements on our website, which help generate revenue to support our work and keep our content free for readers. Our editorial team operates independently of our advertising and affiliate partnerships to ensure that our content remains unbiased and focused on providing you with the best information and recommendations based on thorough research and honest evaluations. To remain transparent, we’ve provided a list of our current affiliate partners here.

Our Promise to you

Founded in 2002, our company has been a trusted resource for readers seeking informative and engaging content. Our dedication to quality remains unwavering—and will never change. We follow a strict editorial policy, ensuring that our content is authored by highly qualified professionals and edited by subject matter experts. This guarantees that everything we publish is objective, accurate, and trustworthy.

Over the years, we've refined our approach to cover a wide range of topics, providing readers with reliable and practical advice to enhance their knowledge and skills. That's why millions of readers turn to us each year. Join us in celebrating the joy of learning, guided by standards you can trust.

What is Logical Programming?

By Jessica Reed
Updated: May 16, 2024

Logical programming is a type of computer programming in which the programmer must give the computer instructions on how to make decisions using mathematical logic, such as the use of a mathematical algorithm. Computer programs are made up of code that tells the computer what to do. Eventually, however, the computer will run into an instance where it must make a decision on how to proceed and without any information on how to do this, it could not complete its current function. Logic programming deals with these types of decisions and gives instructions to the computer so it can make a "logical" decision about how best to respond to a certain situation. For logic programming to work, the programmer writing the code needs to ensure her statements make sense and are true, thus are logical, and a computer program known as a theorem-prover is required to make decisions based on the statements it encounters in the programmer's code.

A theorem-prover refers to a computer program that has been designed to solve mathematical statements known as theorems. Theorems are statements that are shown to be true based on previous statements. In logical programming, the theorem-prover works together with the statements created by the computer programmer to reach conclusions. For example, if the code states that A is equal to B and B is equal to C, the theorem-prover will make the logical conclusion that A must be equal to C. This process is different than the programmer simply telling the computer in the code that A is equal to C because the computer program must draw this conclusion using the theorem-prover and the programmer's original statements in the code.

In theory, for logical programming to work, the programmer only needs to ensure that her statements are correct and the creator of the theorem-prover should ensure that the program can read statements and make the most efficient decisions based on them. The ability to make an efficient decision is referred to as a computer functioning "logically." In reality, the two fields of work overlap, and those who perform logical programming often have to change and manipulate the code based on how the theorem-prover works in order to achieve the results they want. Simply putting in accurate statements about how to make a certain decision may not be enough to get the computer to perform the correct function, and the programmer will have to test her code and make adjustments accordingly.

For logical programming to work, it also relies on backward reasoning. In backward reasoning, the program comes to conclusions by looking at a set of data and working from general known statements to reach more advanced conclusions. The program may know that two pieces of information are true, and it will infer that since those two pieces of information are true, that means a third piece of information is also true. It continues this process until it reaches a logical conclusion based on the information it's given. Due to the way it works, logical programming is built on declarative representation language, meaning the program tells the computer what it should do, but leaves it up to the theorem-prover to determine the most logical or efficient way to perform the requested procedure.

EasyTechJunkie is dedicated to providing accurate and trustworthy information. We carefully select reputable sources and employ a rigorous fact-checking process to maintain the highest standards. To learn more about our commitment to accuracy, read our editorial process.
Discussion Comments
EasyTechJunkie, in your inbox

Our latest articles, guides, and more, delivered daily.

EasyTechJunkie, in your inbox

Our latest articles, guides, and more, delivered daily.