0% found this document useful (0 votes)
82 views52 pages

Chapter 1: Formal Logic: Tannaz R.Damavandi Cal Poly Pomona

This document provides an overview of formal logic including statements, symbolic representation, and tautologies. It defines key logical terms like statements, truth values, logical connectives, and truth tables. It explains how to represent statements symbolically and evaluate their truth values. Examples are provided to illustrate negation, conjunction, disjunction, implication, and De Morgan's laws. Practice problems are included for students to apply the concepts. The document aims to introduce the basic concepts and tools of formal logic.

Uploaded by

CL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
82 views52 pages

Chapter 1: Formal Logic: Tannaz R.Damavandi Cal Poly Pomona

This document provides an overview of formal logic including statements, symbolic representation, and tautologies. It defines key logical terms like statements, truth values, logical connectives, and truth tables. It explains how to represent statements symbolically and evaluate their truth values. Examples are provided to illustrate negation, conjunction, disjunction, implication, and De Morgan's laws. Practice problems are included for students to apply the concepts. The document aims to introduce the basic concepts and tools of formal logic.

Uploaded by

CL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 52

Chapter 1 : Formal Logic

Tannaz R.Damavandi
Cal Poly Pomona
Credit for some of the slides in this lecture goes to Dr.Fang Tang
Outline
• 1.1 – Statements, Symbolic Representation,
and Tautologies
• 1.2- Propositional Logic
• 1.3- Quantifiers, Predicates and Validity
• 1.4- Predicate Logic
• 1.5- Logic Programming (Not covered in this
class)
Section 1.1 – Statements, Symbolic Representation,
and Tautologies

3
Statement
A statement (or proposition) is a sentence that is
either true or false but not both.

Truth value of a statement is T (1).


False value of a statement is F (0).

Usually, we use capital letters A, B, and C to


represent statements.

4
Practice 1
Which ones are statements?
• 2 is an integer number.
• 5 is less than 0.
• Do your best!
• How are you?
• All mathematicians wear sandals.
• X -2 >0
Convention: When there is a non-specific item in the
sentence, then it is not considered as a statement.

5
What is logic?
Although logic was introduced and used by Aristotle and Plato in the
ancient world, the best quick phrase for logic was presented by John
Locke (British Philosopher and Physician (1632- 1704) as, “Logic is
the anatomy of thoughts”.

 Although logic is of no help in determining if an individual


statement is true or false; it assures the truth or falsehood of an
argument that is made based upon those individual statements.

• Logic focuses on the relationship between


statements as opposed to the content of
any particular statement.

Sen, M. (2011). An introduction to critical thinking. Delhi: Longman.


Domains of Logic

Logic

Formal
Informal:
(Symbolic):
concerned with
concerned with
content
form

In order to present statements symbolically, we


should strip away their meanings.
7
Example
A. All mathematicians love apples.
B. Anyone who loves apples is smart.
C. Therefore, all mathematicians are smart.

• Logic cannot help us to determine the individual truth of the


above statements, however, if statements A and B are true, what
can we say about C?

• Logical methods are used in mathematics to prove theorems and


in computer science to prove that programs do what they are
supposed to do.

8
Formal Logic- more definitions:

 The foundation for the organized, careful method


of thinking that characterizes any reasoned
activity.

 It is the study of reasoning: specifically


concerned if something is true or false.
Logical Connectives and Truth Values
 Logical connectives are symbols such as , ‘, Λ, V, , 
◦ ‘ represents Negation
◦ Λ represents And
◦ V represents Or
◦  represents Implication (if .. Then ...)
◦  represents Equivalence (If and only if - iff)

Negation is unary connective while Λ, V, ,  are binary connectives.

 A statement form or propositional form or (compound statement) is an


expression made up of statement variables (such as A and B) and logical
connectives (such as Λ, V, , ) that becomes a statement when actual
statements are substituted for the component statement variables.
◦ Example: (A V A)  (B Λ B)
10
Connective #1: Negation(‘)
 If A is a statement variable, the negation of A is “not A” and is
denoted as A.
 It has the opposite truth value from A: if A is true, then A is false;
if A is false, then A is true.
 Other forms: “It is false that A …”, “It is not true that A …”, etc.
 Unary connective, instead of binary connective.

Example:
A A'
A : 2*2 is less than 5.
A : 2*2 is greater or equal than 5. T F

B: She hates math. F T


B: She likes math.

11
Truth Table
Definition:
A truth table is a table which displays the truth
values of a compound statement that correspond to
all different combinations of truth values of the
statement variables.

12
Truth Table (Cont’d)
The total number of rows in a truth table for n statement letters is 2n.
Connective #2: Conjunction(Λ)
• If A and B are statement variables, the conjunction of A and B
is A Λ B, which is read "A and B“
• A Λ B is true when both A and B are true. A Λ B is false when at
least one of A or B is false.
• Logical expression: A Λ B.
• English words: and; but; also; in addition; moreover

A B AΛB
T T T
T F F
F T F
F F F
14
Connective #3: Disjunction (V)
• If A and B are statement variables, the disjunction of A and B is
A V B, which is read "A or B"
• A V B is true when at least one of A or B is true. A V B is false
when both A and B are false.
• Logical expression: A V B
• English word: or

A B AVB
T T T
T F T
F T T
F F F
15
Important Note!
Negation, Conjunction and Disjunction
Expressing the negation of a statement must be done
with care, especially for a compound statement.

In a negation, and becomes or and vice versa.

 Example:
A : She hates math and likes history.
A : She likes math or hates history.

16
Practice 2
 A = It will rain tomorrow. What’s A’?
◦ It is false that it will rain tomorrow.
◦ It will not rain tomorrow.
 B = Peter is tall and thin. What’s B’?
◦ (1) Peter is not tall or he is not thin.
◦ (2) Peter is short or fat.
◦ (3) It is false that Peter is tall and thin.
◦ (4) Peter is short and fat. Too strong! Peter fails to have both
properties (tallness and thinness) both may still have one of
them.(WRONG!)
 C = The river is shallow or polluted. What’s C’?
◦ (1) The river is neither shallow nor polluted.
◦ (2) The river is deep and unpolluted.
◦ (3) It is false that the river is shallow or polluted.
◦ (4) The river is not shallow or not polluted .Too weak a statement.
The river fails to have either property, not just fails to have one
property.(WRONG!)
17
De Morgan’s Laws

1.(A V B)  A Λ B
2.(A Λ B)  A V B

Augustus De Morgan (1806 – 1871) was a British mathematician and logician. He formulated De Morgan's
laws and introduced the term mathematical induction, making its idea rigorous.

Source : https://en.wikipedia.org/wiki/Augustus_De_Morgan
Example:
Constructing truth table prove:
(A V B)  A Λ B
Practice 3
Constructing truth table prove:
(A Λ B)  A V B
Connective #4: Implication()
• If A and B are statement variables, the symbolic form of "if A then B" is AB.
• Here A is called the hypothesis/antecedent statement and B is called the
conclusion/consequent statement.
• "If A then B'' is false when A is true and B is false, and it is true otherwise.
• Logical Expression : AB
• English words:
– A implies B.
– B if A.
– Whenever A, B A B AB
– A, therefore B. T T T
– B follows from A. T F F
– A is a sufficient condition for B. F T T
– B is a necessary condition for A. F F T
– A only if B.

21
Example
If you get 90 or above then you are guaranteed an A.

Here B is you are guaranteed an A and A is You get 90


or above.
But what if this condition is not met? We don’t know.
The truth of the condition cannot be determined. So it
is considered to be true as default or vacuously true.

22
Practice 4
Rewrite each of the following statements in the form “if A,
then B.”
Errors were introduced only if there was a modification
of the program.
If errors were introduced, then there was a modification of
the program.
Fuel saving implies good insulation or storm windows
throughout.
If there is a fuel saving, then there is good insulation or
storm windows throughout.
Increased availability of information is a necessary
condition for future technological advances.
If there are future technological advances, then there is
increased availability of information.
23
Practice 5
What’s the truth value of the following:

– 8 is even or 6 is odd.
– 8 is even and 6 is odd.
– If 8 is odd, then 6 is odd.
– If 8 is even, then 6 is even.
– If 8 is even, then 6 is odd.

24
Practice 5
What’s the truth value of the following:

– 8 is even or 6 is odd. 
– 8 is even and 6 is odd. 
– If 8 is odd, then 6 is odd. 
– If 8 is even, then 6 is even. 
– If 8 is even, then 6 is odd. 

25
Another Form of Implication
Representation of If-Then using Or
A  B = “If you do not do your homework, then you will flunk”
A = “You do not your homework”
B = “You will flunk”
A' = “You do your homework”
A' V B = “Either you do your homework or you will flunk”
Therefore , A  B  A V B

26
Connective #5: Equivalence ()
If A and B are statement variables, the symbolic form of “A if, and only
if, B" and is denoted A  B.
It is true if both A and B have the same truth values and is false if A and B
have opposite truth values.
Logical Expression: A  B
English word: “A is necessary and sufficient for B”, “A is equivalent to
B”, “A if and only if B”.
Note: A  B is a short form for (A  B) Λ (B  A)

27
Truth Tables
Well-Formed Formula (wff)
We can string statement letters, connectives, and parentheses (or brackets) together
to form new expressions.

A legitimate string is called a well-formed formula, or wff

For example, (AB)V(BA) is a wff, but A))VB(C) is not

Formally:
 All propositional variables and the constants True and False are wffs.
 If A and B are wffs, then A’, B’, A Λ B, A V B, AB, AB, (A’), (B’),
(A Λ B), (A V B), (AB), (AB) are wffs.

Letters like P, Q, R, S etc. are used for representing wffs.


For example, [(A V B) Λ C]  A V C can be represented by P  Q where P is
the wff [(A V B) Λ C] and Q represents A V C
29
Well-Formed Formula (wff)
To reduce the number of parentheses, an order is stipulated in which
the connectives can be applied, called the order of precedence which
is as follows:
◦ Connectives within parentheses, innermost parentheses first
◦ Negation (')
◦ Conjunction (Λ),Disjunction (V)
◦ Implication ()
◦ Equivalence ()

Hence:
A V B  C is the same as (A V B)  C.
A Λ B’ stands for A Λ(B’) not (A ΛB)’.

The main connective is the one that is applied last.


In A Λ(BC)’ the main connective is Λ.
30
Challenge 1
Using the rules of precedence, construct the truth table
of the following wff:
A V B  (A V B)

31
Challenge 1
Using the rules of precedence, construct the truth table
of the following wff:
A V B  (A V B)

32
Tautology and Contradiction
 Tautology :
A wff that its truth values are always true, is called a “tautology”.
A tautology is “intrinsically true” by its very structure; it is true no matter what
truth values are assigned to its statement letters.

Example:
It will rain today or it will not rain today ( A V A )

 Contradiction :
A wff that its truth values are always false, is called a “contradiction”.
A contradiction is “intrinsically false” by its very structure; it is false no matter
what truth values are assigned to its statement letters.

Example:
It will rain today and it will not rain today ( A Λ A )

Usually, tautology is represented by 1 and contradiction by 0

33
Tautological Equivalences
 Two statement forms are called logically equivalent if, and only if, they
have identical truth values for each row of the truth table.
 The logical equivalence of statement forms P and Q is denoted by
writing P  Q or P  Q.
 Prove by constructing truth table
(A V B) V C  A V (B V C)

34
Some Common Equivalences
Since the equivalences are listed in pairs, they are called duals of
each other.
One equivalence can be obtained from another by replacing V with
Λ and 0 with 1 or vice versa.

Commutative AVBBVA AΛBBΛA


Associative (A V B) V C  A V (B V C) (A Λ B) Λ C  A Λ (B Λ C)

Distributive A V (B Λ C)  (A V B) Λ (A V C) A Λ (B V C)  (A Λ B) V (A Λ C)

Identity AV0A AΛ1A

Complement A V A´  1 A Λ A´  0

35
Practice 6
Using truth table prove following equivalence
A V (B Λ C)  (A V B) Λ (A V C)

36
Additional Equivalences
• De Morgan’s Laws
– (A V B)’  A’ Λ B’
– (A Λ B)’  A’ V B’
Example : if A is the statement “Julie likes butter but hates cream”,
what is A’?
• Double negation: (A’)’  A
• Rewriting implication: (A  B)  A’ V B
• Contraposition: (A  B)  (B’  A’)
• Conditional proof: A  (B  C)  (A Λ B)  C
– “If I miss the train today, then I can arrive only 5 minutes
late, assuming that the next train is on time.”

37
Additional Equivalences
• Suppose P and Q are equivalent wffs. Then P can be replaced
by Q in any wff R containing P, resulting in a wff RQ that is
equivalent to R

• Example:
– R: (A  B)  B
– P: A  B, Q: B’  A’
– RQ : (B’  A’)  B
Prove: R ↔ RQ

38
Algorithm
 Definition of an algorithm:
A set of instructions that can be mechanically executed in a
finite amount of time in order to solve a problem
unambiguously.

 Algorithms are the stage in between the verbal form of a


problem and the computer program.
 Algorithms are usually represented by pseudocode.

 Pseudocode is an artificial and informal language that helps


programmers develop algorithms. Pseudocode is a "text-based"
detail (algorithmic) design tool.

 Pseudocode should be easy to understand even if you have no


idea of programming.
39
Pseudocode Example
 Pseudo code that reads two numbers and multiplies them together and
print out their product.

Read num1 , num2


Result = num1*num2
Write Result

 Pseudo code that prints all positive multiples of 5 between 1 and 100
(including 100)

x = 5 // initial value
i = 1 // Initial value
While(i <= 20)
write x
i = i +1
x = i*5
end while
40
Logical Connectives in Computer Science
• Web search engine
• Conditional statement in programming use logical connectives with
statements
• Example:
if ((outflow > inflow) and
not ((outflow > inflow) and (pressure < 1000)))
do something;
else
do something else;
• A: outflow > inflow
• B: pressure < 1000
• A Λ (A Λ B)’
• Can we simplify this?

41
Review of Section 1.1
 Techniques:
◦ construct truth tables for compound wffs
◦ recognize tautologies and contradictions

 Main ideas:
◦ wffs are symbolic representation of statements
◦ truth values for compound wffs depend on the truth value
of their components and the types of connectives used
◦ tautologies are intrinsically true wffs – true for all truth
values

42
Section 1.2 Propositional Logic
Propositional Logic
 Statements are called propositions.
 Wffs are also called propositional wffs.

 In order to reach logical conclusions based on given statements,


we need a formal system that uses propositional wffs.
 This formal system is called propositional logic.

Deriving logical conclusion by combining many propositions and


using formal logic: hence, determining the truth of arguments.

44
Argument
An argument is a sequence of statements in which the
conjunction of the initial statements (called the
premises/hypotheses) is said to imply the final statement
(called the conclusion).

An argument can be presented symbolically as:


(P1 Λ P2 Λ ... Λ Pn)  Q
Where P1, P2, ..., Pn represent the hypotheses and Q
represents the conclusion.

45
Argument (Cont’d)
(P1 Λ P2 Λ ... Λ Pn)  Q
Of course this implication is true if any of the hypothesis
is false. Why?
But in an argument we usually care about what happens
when all the hypothesis are true.
Also, this implication should be true based on
relationship of the conclusion to hypothesis.
Example:
◦ P1: George Washington was the first president of the United States.
◦ P2 : Thomas Jefferson wrote the Declaration of Independence.
◦ Q : Everyday has 24 hours.
Even though both hypothesis and conclusion are true statements, we
wouldn’t consider this argument valid. 46
Valid Argument
An argument is valid if whenever the hypotheses
are all true, the conclusion must also be true.
Hence (P1 Λ P2 Λ ... Λ Pn)  Q is a tautology.

How to arrive at a valid argument


Using a proof sequence

47
Proof Sequence
• To test whether (P1 Λ P2 Λ ... Λ Pn)  Q is a tautology:
– Build a truth table
– Generate a proof sequence (new way) by applying
derivation rules.

• Definition of Proof Sequence:


– A sequence of wffs in which each wff is either a
hypothesis or the result of applying one of the formal
system’s derivation rules to earlier wffs in the sequence.
– The above proof sequence results in many numbers of
wffs and finally it will result in the conclusion.
48
Derivation Rules
The derivation rules for a formal system must be
carefully chosen. We need a formal logic system
that is correct (only valid arguments should be
provable) and complete (every valid argument
should be provable). In addition, the derivation
rules should be kept to a minimum in order to make
the formal systems manageable.

49
Derivation Rules for Propositional Logic

Equivalence Rules Inference Rules

Allows individual wffs to be Allows new wffs to be derived


rewritten

Truth preserving rules Work only in one direction

50
Equivalence Rules
• These rules state that certain pairs of wffs are equivalent,
hence one can be substituted for the other with no change to
its truth values.
• Allows substitution in either direction
Let R and S be statement variables

Expression Equivalent to Name/Abbreviation


RVS SVR communicative / comm
RΛS SΛR
(R V S) V Q R V (S V Q) associative / ass
(R Λ S) Λ Q R Λ (S Λ Q)
(R V S)’ R’ Λ S’ De Morgan’s laws /
(R Λ S)’ R’ V S’ De Morgan
RS R’ V S implication / imp
R (R’)’ double negation / dn
RS (RS) Λ (SR) equivalence / equ
51
Example
Suppose that one hypothesis of a propositional
argument can be symbolized as follow:
(A’ V B’) V C
Then a proof sequence could be begin as follow:
1. (A’ V B’) V C hyp (hypothesis)
2. (A Λ B)’ V C 1, De Morgan
3. (A Λ B)  C 2, imp

52

You might also like