Nepedia
Back to Discover
Independent Reader
💻

Logic programming

technology Maturity 11-13 Next article →

Computers can solve problems using logic. This is called logic programming. It is a way to tell a computer what is true.

A logic program uses two main parts. The first part is facts. A fact is a simple truth. For example, a program might state that Charles is the father of William. The second part is rules. Rules connect facts together. A rule says one thing is true if other things are also true. You might write a rule that says someone is a parent if they are a mother or a father.

In some languages, like Prolog, the computer uses backward reasoning. This means it starts with a goal. It then works backward through the rules to find the facts. This helps the computer find answers to questions. You can ask the computer to find a grandparent or a sibling. It looks at the rules and facts to give you the answer.

Logic programming helps us build databases and smart systems. It was very popular in the 1980s. People used it to try and build advanced artificial intelligence. Today, it is still used to help computers understand information.

190 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.