Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

BCE 111:

COMPUTATIONAL
LOGIC
INTRODUCTION TO
COMPUTATIONAL LOGIC
1.0 What is Computational Logic?

• Computational logic is the use of logic to perform or reason


about computation.
• It bears a similar relationship to computer science and
engineering as mathematical logic bears to mathematics and
as philosophical logic bears to philosophy.

What is Logic?

Logic, the study of correct reasoning, especially as it involves


the drawing of inferences.
• It includes both formal and informal logic.

• Formal logic is the science of deductively valid inferences or


of logical truths.

• Formal logic contrasts with informal logic, which is


associated with informal fallacies, critical thinking, and
argumentation theory.
• When most people say ‘logic’, they mean either propositional
logic or first-order predicate logic.

• Any ‘formal system’ can be considered a logic if it has:


– a well-defined syntax;
– a well-defined semantics; and
– a well-defined proof-theory.
Logic is a process for making a conclusion and a
tool you can use.
• The foundation of a logical argument is its
proposition, or statement.
• The proposition is either accurate (true) or not
accurate (false).
• Premises are the propositions used to build the
argument.
• The argument is then built on premises.
• Then an inference is made from the premises.
• Finally, a conclusion is drawn.
• The syntax of a logic defines the syntactically
acceptable objects of the language, which are properly
called well-formed formulae (wff). (We shall just call
them formulae.)

• The semantics of a logic associate each formula with a


meaning.

• The proof theory is concerned with manipulating


formulae according to certain rules.
We have seen that there are two classes of logic: propositional logic and predicate
logic. These two will form the basis for studying this course. We shall begin with
propositional logic which will take half of the semester and predicate logic another
half.
2.0 Propositional Logic
• The word logic refers to the use and study of valid
reasoning. Logic contains rules and techniques to
formalize statements, to make them precise.
• Logic is studied by philosophers, mathematicians
and computer scientists.
• Logic appears in different areas of computer science,
such as programming, circuits, artificial intelligence
and databases.
• The term propositional logic thus refers to a logic
which relies on propositions.
• Definition: A proposition is a statement that can be either
true or false; it must be one or the other, and it cannot be
both.
• Examples of propositions

• Examples (which are not propositions)


• We just said that a proposition is a statement which is either
true or false. We next give a definition for a statement which
cannot be assigned a truth value.
• Definition: A paradox is a statement that cannot be assigned a
truth
value.
Thus a paradox cannot be a proposition!
Example: “This statement is false”

• Definition: An atomic proposition is one whose truth or falsity does


not depend on the truth or falsity of any other proposition. So all
the above propositions are atomic.
• Definition: A compound proposition is a statement obtained by
combining propositions with logical operators. We shall discuss the
operators used in computational logic next.
2.1 Symbolic Logic
• The study of atomic propositions is pretty boring. We therefore
now introduce a number of connectives or operators which will
allow us to build up complex propositions.
• Here, we use symbols to represent statements (both have the
same truth values). For instance, the statement “Nairobi is the
Capital City of Kenya” can be represented using a letters such as p,
q, r, ……. such that

p: Nairobi is the Capital City of Kenya


q: John is a BCE 111 student
r: 3 +2 = 7
This therefore means that we can use letters to represent statements
rather than write out the propositions in full.
2.2 Connectives or operators
• The connectives we introduce are:

NB: Some books use


other notations; these
are given in
parentheses.

2.2.1 And
• Any two propositions can be combined to form a third
proposition called the conjunction of the original
propositions.
• Definition: If p and q are arbitrary propositions, then the
conjunction of p and q is written
p∧q
and will be true iff both p and q are true.
• We can summarise the operation of ∧ in a truth table. Let
us write T for truth, and F for falsity. Then the truth table for
p ∧ q is:
Conjunction ∧ (and)

∧ is also
commutative:
p∧q≡q∧p
2.2.2 Or
• Any two propositions can be combined by the word ‘or’ to
form a third proposition called the disjunction of the
originals.
• Definition: If p and q are arbitrary propositions, then the
disjunction of p and q is written:
p∨q
and will be true iff either p is true, or q is true, or both p
and q are true.

p ∨ q ≡ q ∨ p,
i.e. operator ∨ commutes
≡ means equivalent

You might also like