**Theory of First-order Logic**

First-order logic is also called **Predicate logic** and **First-order predicate calculus** (FOPL). It is a formal representation of logic in the form of quantifiers. In predicate logic, the input is taken as an entity, and the output it gives is either true or false.

### Syntax and Semantics of FOPL

**Syntax:** It defines the way of representing the given predicates. As these predicates are represented via quantifiers, there are different types of quantifiers used:

**Universal Quantifier(For all/every):**When the predicate is indicating about all/everything, we use**for all**quantifier. It is denoted as**“****∀ “****Existential Quantifier(For some):**When the predicate is indicating about some quantity, we use**for some**quantifier. It is denoted as**“Ǝ”****Nested Quantifiers:**It is the nesting of the same type of quantifier. One predicate is nested under the other predicate.**Atomic Sentences:**These sentences are formed via predicate symbols may or may not be followed by a list of terms.

**Example:** Parents(Ram, Sita) where Ram and Sita are the parents.

**Complex Sentences:**These sentences make use of logical connectives to construct more complex sentences.**Equality:**We use the equality symbol to express that two terms refer to the same object**. For example,**Eleveenth_President(India)= Dr. APJ Abdul Kalam. Here, both LHS is equal to RHS. It means that both terms refer to the same entity/ person.

**Elements and their symbols in Predicate Logic**

**The elements for which different symbols are defined are:**

**Objects:**It refers to an entity that exists in the real world.**For example,**Ram, John, etc. are referred to as Objects.**Functions:**Any function performed by the object/on the object.**For example,**LeftLeg, writes, eats, etc. are some of the functions.**Relations:**The relation of an object with the other object defines its relation**. For example,**brother, mother, king, etc. are some types of relations which exist in the real world.

**Now, let’s discuss the symbols used to represent these elements. They are as follows:**

**Constant Symbols:**These symbols are used to represent the objects.**Predicate Symbols:**These symbols are used to represent relations.**Function Symbols:**These symbols are used to represent the functions performed by the object.

**Semantics:** It defines the sense of the given predicate. It allows to make more logical expression by devising its semantics. Semantics allow us to understand the sentence meaning.

**Let’s understand Predicate logic with the help of below examples:**

**Example 1:** Lipton is a tea.

**Solution:** Here, the object is Lipton.

It will be represented as **Tea(Lipton).**

**Note:** In this example, there is no requirement of quantifiers because the quantity is not specified in the given predicate. **Let’s see more.**

**Example 2:** Every man is mortal.

**Solution:** Here, the quantifier is the universal identifier, and the object is man.

Let x be the man.

Thus, it will be represented as **x: man(x) → mortal(x).**

**Example 3:** All girls are beautiful.

**Solution:** Here, we are talking about all girls. It means universal quantifier will be used. The object is girls. Let, y be the girls.

Therefore, it will be represented as **girls(y) ** **→** **beautiful(y).**

**Example 4:** All that glitters is not gold.

**Solution:** Here, we will represent gold as x.

Therefore, it will be represented as **glitters(x) ** **→** **¬gold(x).**

**Example 5: **Some boys are obedient.

**Solution:** Here, boys are objects. The quantifier used will be existential quantifier. Let x be the boys. Thus, it will be represented as

**Ǝx: boys(x)** **→** **obedient(x).**

**Example 6:** Some cows are black and some cows are white.

**Solution:** Let, x be the cows. Therefore, it will be represented as:

**Ǝx: cows(x)** **→** **black(x) Ʌ white(x).**

<strong>Note:</strong> There can be several examples of Predicate logic.

### Knowledge Engineering in FOPL

Knowledge engineering is the process where a knowledge engineer investigates a specific domain, learn the important concepts regarding that domain, and creates the formal representation of the objects and relations in that domain.

### Knowledge Engineering Process

An engineering term is used when we are talking about any project. **Therefore, knowledge engineering over a project involves the below described steps:**

**Identify the task:**A knowledge engineer should be able to identify the task by asking a few questions like:- Do the knowledge base will support?
- What kinds of facts will be available for each specific problem?

The task will identify the knowledge requirement needed to connect the problem instance with the answers.

**Assemble the relevant knowledge:**A knowledge engineer should be an expert in the domain. If not, he should work with the real experts to extract their knowledge. This concept is known as**Knowledge Acquisition**.

**Note:** Here, we do not represent the knowledge formally. But to understand the scope of the knowledge base and also to understand the working of the domain.

**Decide on a vocabulary of constants, predicates, and functions:**Translating important domain-level concepts into logical level concepts.

**Here, the knowledge engineer asks questions like:**

- What are the elements which should be represented as objects?
- What functions should be chosen?

After satisfying all the choices, the vocabulary is decided. It is known as the **Ontology of the domain**. Ontology determines the type of things that exists but does not determine their specific properties and interrelationships.

**Encode general knowledge about the domain:**In this step, the knowledge engineer pen down the axioms for all the chosen vocabulary terms.

**Note:** Here, misconceptions occur between the vocabulary terms.

**Encode description of the specific problem instance:**We write the simple atomic sentences for the selected vocabulary terms. We encode the chosen problem instances.**Raise queries to the inference procedure and get answers:**It is the testing step. We apply the inference procedure on those axioms and problem-specific facts which we want to know.**Debug the knowledge base:**It is the last step of the knowledge engineering process where the knowledge engineer debugs all the errors.