2. Introduction
• classical logic that are necessary for the
understanding of formal development methods
• begin by presenting the propositional logic
– which deals with simple truthvalued
– statements that can be combined according to a set of
rules
• Further, present the predicate logic, which is an
essential tool needed in the formal specification
27 October 2022
Computer Science Department,
University of Sahiwal
2
3. Propositions
In classical logic, propositions are
statements that are either
TRUE or FALSE.
27 October 2022
Computer Science Department,
University of Sahiwal
3
4. Propositions Examples (True)
• The following are examples of propositions
that evaluate to TRUE:
There are seven days in a week
Paris is the capital of France
2 + 4 = 6
27 October 2022
Computer Science Department,
University of Sahiwal
4
5. Propositions Examples (False)
• The following propositions evaluate to FALSE:
The angles of a triangle add up to 360
London is the capital of France
2 - 4 = 7
27 October 2022
Computer Science Department,
University of Sahiwal
5
6. Examples with Symbol
• In mathematics we often represent a
proposition symbolically by a variable name
such as P or Q.
• For example:
P: I go shopping on Wednesdays
Q: 102.001 > 101.31
27 October 2022
Computer Science Department,
University of Sahiwal
6
7. • Occasions arise when it is not possible to
evaluate expressions precisely – maybe a
program terminated incorrectly, or perhaps
somebody tried to evaluate the square root of
a negative integer.
27 October 2022
Computer Science Department,
University of Sahiwal
7
8. • It is possible to account for such situations by
defining a three-valued logic, which allows a
proposition to take the value UNDEFINED as
well as TRUE or FALSE.
27 October 2022
Computer Science Department,
University of Sahiwal
8
9. Logical Connectives
• Simple propositions can be combined into
compound statements by operators called
logical connectives.
27 October 2022
Computer Science Department,
University of Sahiwal
9
10. Truth Tables
• The purpose of defining these connectives is
to provide a rigorous framework that gives
precise meaning to such words as ‘AND’ and
‘OR’ that occur in the natural language. The
way we give semantic meaning to these
connectives is to provide tables known as
truth tables,
27 October 2022
Computer Science Department,
University of Sahiwal
10
11. The AND operator
• The operator known as AND is represented by
the symbol “^”.
• The statement P AND Q is therefore
represented by:
P ^ Q
27 October 2022
Computer Science Department,
University of Sahiwal
11
12. Cont.
• The precise meaning of this operator is given
in the following truth table, where TRUE and
FALSE are represented by T and F, respectively.
• you can see that the first two columns of the
truth table provide all the possible
combinations of the values of P and Q.
• The final column shows the corresponding
value of the combined statement P Q.
27 October 2022
Computer Science Department,
University of Sahiwal
12
13. Truth table “AND” Operator
P Q P ^ Q
T T T
T F F
F T F
F F F
27 October 2022
Computer Science Department,
University of Sahiwal
13
14. Conjunction
• Combining two propositions with the AND
operator is known as conjunction.
• Individual proposition in the compound
statement is known as a conjunct.
27 October 2022
Computer Science Department,
University of Sahiwal
14
15. The OR operator
• The operator known as or is represented by
the symbol .
• The statement P or Q is therefore represented
by:
P V Q
27 October 2022
Computer Science Department,
University of Sahiwal
15
16. OR Example
• Thus if P represented the statement It is
raining and Q represented the statement
Today is Tuesday then:
• P v Q would represent the statement It is
raining or today is Tuesday.
• The precise meaning of this operator is given
in the following truth table.
27 October 2022
Computer Science Department,
University of Sahiwal
16
17. Truth table “OR” Operator
P Q P Q
T T T
T F T
F T T
F F F
27 October 2022
Computer Science Department,
University of Sahiwal
17
18. Disjunction
• Combining two propositions with the or
operator is known as disjunction.
• individual proposition in the compound
statement is known as a disjunct.
27 October 2022
Computer Science Department,
University of Sahiwal
18
19. The implication operator
• In defining an implication operator we
attempt to give meaning to the expression P
implies Q.
• The implication operator is represented by the
symbol ⇒. The statement P implies Q is
therefore represented by:
P ⇒ Q
27 October 2022
Computer Science Department,
University of Sahiwal
19
20. Cont.
• An alternative way of expressing implication is
if P then Q.
• Thus if P represented the statement “It is
Wednesday and Q represented the statement
I do the ironing” then:
• P ⇒ Q would represent the statement “If it is
Wednesday I do the ironing”.
• The truth table for implication appears next,
and requires some explanation.
27 October 2022
Computer Science Department,
University of Sahiwal
20
21. Truth table “implication” Operator
P Q P⇒Q
T T T
T F F
F T T
F F T
27 October 2022
Computer Science Department,
University of Sahiwal
21
22. Cont.
• The first two rows of the table capture the
central idea of implication: if the first and
second statements are both TRUE, then the
statement that the first implies the second is
also TRUE.
• whereas if the first is TRUE but the second is
not, then the statement that the first implies
the second is FALSE.
27 October 2022
Computer Science Department,
University of Sahiwal
22
23. Further Readings
• Palgrave Macmillan Formal Software
Development From VDM to Java by Quentin
Charatan and Aaron Kans (Chapter 2)
27 October 2022
Computer Science Department,
University of Sahiwal
23
24. Questions
Any Question Please?
You can contact me at: umber@uosahiwal.edu.pk
Your Query will be answered within one working day.
27 October 2022
Computer Science Department,
University of Sahiwal
24