# Quantifiers in knowledge Representation in an AI Agent

In this tutorial, we will learn about the quantifiers and their need in knowledge representation in an intelligent agent. We will study about the types of quantifiers, their properties, their applications and will also look at some examples for understanding them better. By Monika Sharma Last updated : April 12, 2023

## Quantifiers - An Overview

As we know that in an AI-based agent, the knowledge is represented through two types of logic: The propositional logic and the predicate logic. In the propositional logic, we have declarative sentences, and in the predicate logic, we have a predicate defining a subject. But in both these systems, we were not able to define the quantity of any subject.

For example:

The predicate logic: like(boy, apple) defines that boy likes apple. But take a look at the following two statements:

• Some boys like apple
• All boys like apple

These sentences cannot be defined completely with the help of first-order predicate logic. So, to solve this issue, the quantifiers were used.

## What are Quantifiers in Predicate Logic?

Quantifiers are the quantity defining terms which are used with the predicates. Quantifiers contain a statement type of formula, whose value (truth value) may depend on other variables values.

## Types of Quantifiers

There are two types of quantifiers:

### 1. Universal Quantifier

The universal quantifier is used to define the whole subject population under the predicate. It can be used anywhere where the phrases like: 'for all', 'for each', 'for every' are used.

The symbol '∀' is used to represent universal Quantifier. To combine the universal quantifier with the predicate and the subject, implication sign, '->' is used.

Example:

```    ∀x: Boy(x) -> like(x,Apple)
```

The above statement says that: 'All boys like apple'.

### 2. Existential Quantifier

The Existential Quantifier is used at the places where only some part of the subject's population is to be defined under the predicate. It can be used at all the places where the following phrases are used: 'There exist', 'For some', 'For at least', etc.

The Existential Quantifier is represented by the symbol '∃'. To combine the Existential quantifier with the predicate and the subject, the conjunction symbol, '^' is used.

Example:

```    ∃x: Boy(x) ^ like(x,apple)
```

The above statement depicts that there exists a boy who likes apple. Or we can say that there are some boys who like an apple.

## Properties of Quantifiers

• ∀x.∀y is the same as ∀y.∀x
• ∃x.∃y is the same as ∃y.∃x
• ∃x.∀y is not the same as ∀y.∃x
• Quantifier duality: Each quantifier can be expressed using the other one. This is done by complementing and changing the symbols.

Example:

```    ∀x likes(x, Ice-cream) is equivalent to ~∃x ~likes(x, Ice-cream).
∃x likes(x, Chocolate) is equivalent to ~∀x ~likes(x, chocolate).
```