Professional Documents
Culture Documents
5th & 6th Leacture Formal Methods in Software Engineering
5th & 6th Leacture Formal Methods in Software Engineering
Lecture 5
I N S T R U C T O R : Z A RTA S H A K I R A N
First Order Logic in FM
(PREDICATE LOGIC)
Why Predicate logic
But unfortunately, in propositional logic, we ca n only represent the facts, which are either true or
false.
Proposition is constant declarative statement that can result in either true or false.
One of the limitation of propositional logic is that it only argue about the individual value but does not
allow us to argue the set of values
Predicate logic
🠶 First-order logic statements can be divided into two parts:
• Subject: Subject is the main part of the statement.
• Predicate: A predicate can be defined as a relation, which binds two atoms together in a
statement.
🠶 Consider the statement: "x is an integer.", it consists of two parts, the first part x is the
subject of the statement and second part "is an integer," is known as a predicate.
Example:
Consider the statement
“x is greater than 10” Or “X is an even number”
The above statement has 2 parts
1. The first part is “Variable x”. It is the subject of the statement.
2. The second part is the “Is GREATER THAN 10” that refers to a property that the subject can have is
called the ‘’predicate’’
We can denoted the statement “x” is greater tham”10” by the notation p(x)
S(x): x is a student.
Solution: We want to express that for every student x, there exists a course y such that x has
taken y and y is a mathematics course.
∀x(S(x)→∃y(C(y)∧T(x,y)
This formula can be read as "For all x, if x is a student, then there exists a y such that y is a
mathematics course and x has taken y."
Example:
"Every user in the system must have at least one assigned role."
U(x): x is a user.
R(x): x is a role.
∀x(U(x)→∃y(R(y)∧A(x,y)
This formula can be read as "For all x, if x is a user, then there exists a y such that y is a role, and
x is assigned y."
Example:
"There exists an employee in the database who is a manager."
E(x): x is an employee.
M(x): x is a manager.
Solution:
Using these predicates, we can express the requirement as a logical formula.
∃x(E(x)∧M(x)
This formula can be read as "There exists an x such that x is an employee and x is a manager."
Predicate Logic
Predicate and Operators
Predicate and Truth Table