# What is predicate logic?

by Stephen M. Walker II, Co-Founder / CEO

## What is predicate logic?

Predicate logic, also known as first-order logic or quantified logic, is a formal language used to express propositions in terms of predicates, variables, and quantifiers. It extends propositional logic by replacing propositional letters with a more complex notion of proposition involving predicates and quantifiers.

In predicate logic, a predicate is a statement or mathematical assertion that contains variables, sometimes referred to as predicate variables, and may be true or false depending on those variables' value or values. For example, "x + 2 = y" is a predicate with two variables, x and y.

Predicates and variables are the core components of Predicate Logic in AI. A predicate is an assertion made regarding one or more things. For instance, the predicate "is blue" declares that a specific item possesses the attribute of being blue.

In the context of AI, predicate logic is a formal framework for deducing relationships between objects and their qualities. It is a mathematical language that enables knowledge to be expressed precisely and unambiguously, making it perfect for usage in AI systems. It is used as a foundational framework for the representation of knowledge and reasoning.

Quantifiers are another crucial aspect of predicate logic. They express the extent to which a predicate is true over a range of elements. There are two types of quantifiers: the universal quantifier, denoted as "∀", and the existential quantifier, denoted as "∃". The universal quantifier "∀x P(x)" means that for all x, P(x) is true. The existential quantifier "∃x P(x)" means that there exists at least one x for which P(x) is true.

In AI, logical expressions in predicate logic are assertions made up of predicates, variables, quantifiers, and logical connectives. They are used to represent relationships between things and their properties and infer and deduce information.

For example, consider the predicate "P(x,y): x + 2 = y". The statement "∀x∃yP(x, y) = T" means that for any x, there exists a y such that x + 2 = y is true. This kind of logical expression can be used in AI to represent and reason about relationships between different entities or concepts.

## Clarifying Predicate Logic, Horn Clauses, and Their Use in AI

First-order logic predicates apply to individual subjects, such as "John is a person," while higher-order logic allows predicates to apply to other predicates, enabling propositions like "is a person who is taller than 5 feet."

Horn clauses, a subset of first-order logic clauses, are structured for efficiency with a single positive literal at most, facilitating easier computation. General first-order clauses, without such restrictions, can be more complex and variable-rich, making them harder to process.

The most general form of a Horn clause is a conjunction of literals with at most one being positive, and without any positive literals, it becomes a Horn formula or sentence. Conversely, the least general form is a ground clause with a single, variable-free literal representing an absolute fact.

In AI, Horn clauses efficiently encode both factual and procedural knowledge, allowing for inference—deriving new facts from existing clauses and facts—and non-monotonic reasoning, which adapts to new information over time. This adaptability is crucial for dynamic environments like stock markets or weather forecasting, making Horn clauses a robust tool for knowledge representation in AI.