Explore 1.5M+ audiobooks & ebooks free for days

From $11.99/month after trial. Cancel anytime.

Logic Programming: Fundamentals and Applications
Logic Programming: Fundamentals and Applications
Logic Programming: Fundamentals and Applications
Ebook142 pages2 hoursArtificial Intelligence

Logic Programming: Fundamentals and Applications

Rating: 0 out of 5 stars

()

Read preview

About this ebook

What Is Logic Programming


A paradigm for computer programming known as logic programming is one that relies heavily on formal logic. Any program that is developed in a logic programming language is merely a collection of statements that are formatted in a logical manner and represent facts and rules regarding a particular issue domain. The answer set programming (ASP) and the Datalog programming languages belong to the major families of logic programming languages. Clauses are the fundamental unit of expression for writing rules in each of these languages:


H :- B1, …, Bn.


How You Will Benefit


(I) Insights, and validations about the following topics:


Chapter 1: Logic programming


Chapter 2: Prolog


Chapter 3: Declarative programming


Chapter 4: Horn clause


Chapter 5: Datalog


Chapter 6: Definite clause grammar


Chapter 7: Constraint logic programming


Chapter 8: SLD resolution


Chapter 9: Abductive logic programming


Chapter 10: Syntax and semantics of logic programming


(II) Answering the public top questions about logic programming.


(III) Real world examples for the usage of logic programming in many fields.


Who This Book Is For


Professionals, undergraduate and graduate students, enthusiasts, hobbyists, and those who want to go beyond basic knowledge or information for any kind of logic programming.

LanguageEnglish
PublisherOne Billion Knowledgeable
Release dateJun 24, 2023
Logic Programming: Fundamentals and Applications

Related to Logic Programming

Titles in the series (100)

View More

Related ebooks

Intelligence (AI) & Semantics For You

View More

Reviews for Logic Programming

Rating: 0 out of 5 stars
0 ratings

0 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    Logic Programming - Fouad Sabry

    Chapter 1: Logic programming

    A paradigm for computer programming known as logic programming is one that relies heavily on formal logic. Any program that is developed in a logic programming language is only a collection of statements that are formatted in a logical manner and represent facts and rules about a certain issue domain. The answer set programming (ASP) and the Datalog programming languages belong to the major families of logic programming languages. Clauses are the primary grammatical unit for expressing rules in each of these languages:

    H :- B1, …, Bn.

    both are interpreted in a declarative manner as logical implications:

    H if B1 and … and Bn.

    H is called the head of the rule and B1, .., Bn is called the body.

    Rules that don't have any form are what we call facts, and are presented here in their streamlined version:

    H.

    In the most straightforward scenario, H, B1, .., Bn are all atomic formulae, Definite clauses, often known as Horn clauses, are another name for these clauses.

    However, This straightforward example may be extended in a variety of ways, the most notable of them is the situation in which conditions in the main part of a sentence might also function as denials of atomic formulae.

    Logic programming languages that make use of this extension are able to describe knowledge in a manner consistent with that of a non-monotonic logic.

    Logic programs in ASP and Datalog only have a declarative reading, and their execution is performed by means of a proof procedure or model generator whose behavior is not intended to be controlled by the programmer. This makes it impossible for the programmer to influence the behavior of the logic program. Nevertheless, under the Prolog family of programming languages, logic programs may furthermore be interpreted in a procedural manner as goal-reduction operations:

    to answer the H, solve B1, and ..

    and solve Bn.

    Take, for instance, the sentence in the following example::

    fallible(X) :- human(X).

    based on an illustration that Terry Winograd provided via the use of an example in the programming language Planner. It is possible to use it as a method to test whether X is fallible by testing whether X is human, and it is also possible to use it as a procedure to discover an X which is fallible by finding an X which is human. This is because it is a clause in a logic program. Even the facts may be interpreted in a procedural manner. As an example, consider the clause:

    human(socrates).

    may be utilized not just as a method to demonstrate that Socrates is a person, but also as a method to locate an X that also has human characteristics by assigning Socrates to X.

    A programmer may utilize the declarative reading of logic programs as a method for verifying the correctness of such programs. In addition, logic-based program transformation methods may be used to turn logic programs into more efficient versions of programs that are logically equal to the ones they were transformed into. In the family of logic programming languages known as Prolog, the developer has the ability to increase the efficacy of programs by making use of the established pattern of problem-solving behavior shown by the execution mechanism.

    The lambda calculus, which was invented by Alonzo Church in the 1930s, includes among its features the application of mathematical logic to both the representation and execution of computer programs. Cordell Green, on the other hand, is credited with making the first suggestion to make use of the clausal style of logic for modeling computer programs. and shown how it handles consequences by using goal-reduction techniques. Colmerauer in Marseille, with whom Kowalski worked together to develop these concepts for the design and implementation of the computer language Prolog, was the one responsible for developing Prolog.

    In 1986, the Association for Logic Programming was established with the purpose of promoting logic programming.

    The programming languages ALF and LF were developed from Prolog, Fril, Gödel, Mercury, Oz, Ciao, Visual Prolog, XSB, and λProlog, in addition to a number of other programming languages for concurrent logic, Maarten van Emden and Robert Kowalski proved that the model-theoretic, fixed-point, and proof-theoretic semantics for Horn clause logic programs are all equal. These semantics were developed by Maarten van Emden and Robert Kowalski.

    Programming logic may be thought of as an exercise in controlled deduction. The notion of separating programs into their logic component and their control component is essential to the field of logic programming and serves as an example of this separation. When using programming languages that are purely based on logic, the logic aspect alone is what decides the answers that are created. Altering the behavior of the control component enables the system to carry out a logic program in a variety of different ways. This idea is encapsulated in the slogan, which reads:

    Logic plus control is what an algorithm is.

    where Control refers to various approaches to theorem-proving and Logic stands for a logic program.

    In the simplified and propositional scenario in which both a logic program and a top-level atomic objective do not include any variables, using backward reasoning to determine a and-or tree, which represents the search space for solving the goal, is how to accomplish the task. The overarching objective serves as the primary focus of this tree. There exists, for each node in the tree and any clause whose head matches the node, a set of child nodes that correspond to the sub-goals in the body of the sentence. This collection of child nodes may be found for any node in the tree. These subnodes are connected to one another with a and operator. An or connects the many groups of children that correspond to the various methods that may be used to solve the node.

    When searching this area, you may use whatever search method you choose. A sequential, last-in-first-out, backtracking method is used in Prolog. During this technique, only one option and one sub-goal are thought about at any one moment. It is also feasible to use other search techniques, such as intelligent backtracking, parallel searching, or best-first searching, in order to locate the most appropriate answer.

    In the more general scenario, in which subgoals share variables, one may use different techniques, such as selecting the subgoal that has the highest level of instantiation or that has a level of instantiation that is adequate enough that only one process is relevant. These kinds of methods are, for instance, used in the field of concurrent logic programming.

    Horn clause logic programs need to be extended to standard logic programs with negative conditions so that they may be used in the majority of practical applications. This is also true for applications that need non-monotonic reasoning in artificial intelligence. The format of a clause in a typical logic program looks like this::

    H :- A1, …, An, not B1, …, not Bn.

    It may be interpreted in a declarative manner as an inference of logical consistency:

    H if A1 and … and An and not B1 and … and not Bn.

    where H and all the Ai and Bi are atomic formulas.

    The negation in the negative literals not Bi is commonly referred to as negation as failure, due to the fact that in the majority of implementations, a negative condition not Bi is shown to hold by showing that the positive condition Bi fails to hold.

    For example:

    canfly(X) :- bird(X), not abnormal(X).

    abnormal(X) :- wounded(X).

    bird(john).

    bird(mary).

    wounded(john).

    Given the objective of locating something that is capable of flight:

    :- canfly(X).

    There are two potential answers, namely X = John and X = Mary, both of which are capable of accomplishing the first subgoal bird(X). The second subgoal of the first candidate solution, not abnormal(john), is unsuccessful due to the fact that wounded(john) is successful, and as a result, abnormal(john) is successful. However, the second subgoal of the second candidate solution, which is not abnormal(mary), is successful since wounded(mary) fails, and as a consequence, abnormal(mary) fails as well. As a result, the sole solution to the aim is for X to equal Mary.

    There was a feature in Micro-Planner known as the thnot

    Enjoying the preview?
    Page 1 of 1