0% found this document useful (0 votes)
35 views27 pages

Lec 2

1. The document introduces the concepts of propositional logic and how it can be used to model and reason about systems. It discusses some key concepts like atomic propositions, connectives, truth tables, tautologies, and De Morgan's laws. 2. Examples are provided to demonstrate how to represent arguments using propositional logic, including modeling conditional statements and constructing truth tables. 3. Different types of compound propositions are defined, including tautologies, contradictions and contingencies. Tasks are given to practice applying concepts like De Morgan's laws and identifying tautologies using truth tables.

Uploaded by

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

Lec 2

1. The document introduces the concepts of propositional logic and how it can be used to model and reason about systems. It discusses some key concepts like atomic propositions, connectives, truth tables, tautologies, and De Morgan's laws. 2. Examples are provided to demonstrate how to represent arguments using propositional logic, including modeling conditional statements and constructing truth tables. 3. Different types of compound propositions are defined, including tautologies, contradictions and contingencies. Tasks are given to practice applying concepts like De Morgan's laws and identifying tautologies using truth tables.

Uploaded by

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

Introduction to Logic

Logic in Computer Science Modeling and


Reasoning About Systems
Lecture 2
Rabbia Mahum
Logic

• Logic is primarily a language to


- model the system (program)
- reason about the correctness or incorrectness of
the system’s properties
Philosophical Logic

• 500 B.C - 19th Century


•Logic dealt with reasoning of arguments in the
natural language used by humans.

• Example: Valid Argument


- All IIUI students are good at studies.
- Faizan is a IIUI student
- Therefore, Faizan is good at studies.
Philosophical Logic

1. If the train arrives late and there are no


taxis at the station, then John is late for his
meeting.
2. John is not late for his meeting.
3. The train did arrive late.
4. Therefore, there were taxis at the station.
• Valid or Invalid?
- Valid (Combine 1, 2 and 3 and then use 4)
Philosophical Logic

• Natural languages are very ambiguous.

• Example:
• Tom hates Jim and he likes Mary.
• Tom likes Mary, or
• Jim likes Mary

•Thus, we need a more mathematical language


for logical reasoning
1.Atomic
Propositional Logic
•A proposition - a sentence that can be
either true or false.
- x is greater than y
- She is teaching Formal Methods in this
term.
- Some students are intelligent (T/F, not a
prop logic)
- 2+1=4
- 3 +2 =5
Activity: Identify Propositions

Every even natural number > 2 is the sum of two


prime numbers.

Today is not friday.

Could you please pass me the salt.


Symbols in Propositional Logic
(syntax)
• Each proposition is assigned a symbol
• ‘x is greater than y.’: p

• ‘He is teaching Formal Methods this term’: q

• ‘I won a gold medal in last years Sports gala.’:


r
Connectives in Propositional Logic
- ∧ and (conjunction):
• a ∧ b: Both a and b are true.
- ∨ or (disjunction)
• a ∨ b: at least one of a or b
are true
- ¬ not (negation)
• ¬ a: a is not true
– →implication (if then)
• a → b: if a then b (a:
assumption, b: conclusion)
- ↔• a ↔ b:equivalent to (if
a is equivalent to b, i.e., a → b ∧ b
-and → a if)
Ⱶ only
– ⊥, T False,
therefore
True
2.Complex Propositional logics

 Negation (Today is not Friday/Atomic).


 Disjunction (You should eat or watch TV at same time).
 Conjunction (Please like my video and subscribe my
channel).
 If then (If there is rain then the roads are wet).
 Iff (I will go to mall if I have to do shopping).
Activity: Modeling with
Propositional Logic
1. If the train arrives late and there are no
taxis at the station, then John is late for his
meeting.
2. John is not late for his meeting.
3. The train did arrive late.
4. Therefore, there were taxis at the station.
Activity: Modeling with
Propositional Logic
1. If the train arrives late (p) and there are no taxis
at the station (q), then John is late for his
meeting (r).
- (p ∧ (¬ q ))→ r
2. John is not late for his meeting.
- ¬r
3. The train did arrive late.
- p
4. Therefore, there were taxis at the station.
- q ((p ∧ (¬ q)) → r) , (¬ r) , p Ⱶ
q
Activity: Modeling with
Propositional Logic
• If a request occurs, then either it will
eventually be acknowledged, or the
requesting process won’t ever be able
to make progress.
Activity: Modeling with
Propositional Logic
• Today it will rain or shine, but not
both.
Truth Table example

 Construct the truth table of the compound proposition (p ∨


¬q) → (p ∧ q).
 The Truth Table of (p ∨ ¬ q) → (p ∧ q).
Propositional Logic Sentences
(Formula)
• Formula :=
• proposition|
• (Formula) |
• (Formula o Formula).

• o is one of the binary


relations
Biconditional
Propositional Logic Formulas

• We omit parenthesis whenever we may

restore them through operator precedence:


 binds more
strictly than , ,
,  bind more strictly than , .
• Thus, we write:

A for
A B ((A)),
A B for ((A ) B)
C for
((AB)  C),
Example: Parenthesis

• Reinsert as many brackets as


possible
Find the negation of the
proposition
 “Vandana’s smartphone has at least 32GB of memory”
 and express this in simple English.
 Solution: The negation is
 “It is not the case that Vandana’s smartphone has at least
32GB of memory”
 Or
 “Vandana’s smartphone does not have at least 32GB of
memory”
Compound Propositions

 Compound proposition that is always true, no matter what


the truth values of the propositional variables that occur in
it, is called a tautology.
 A compound proposition that is always false is called a
contradiction.
 A compound proposition that is neither a tautology nor a
contradiction is called a contingency.
Tautology and Contradiction
De Morgan’s Law
Example
Tasks
 a truth table for each of these compound propositions.
 a) (p ∨ q) ∨ r b) (p ∨ q) ∧ r c) (p ∧ q) ∨ r d) (p ∧ q) ∧ r e)
(p ∨ q) ∧ ¬r f ) (p ∧ q) ∨ ¬r
 Show that each of these conditional statements is a tautology by
using truth tables.
 a) [¬p ∧ (p ∨ q)] → q b) [(p → q) ∧ (q → r)] → (p → r)
 Use De Morgan’s laws to find the negation of each of the following
statements.
 a) Kwame will take a job in industry or go to graduate school.
 b) Yoshiko knows Java and calculus.
 c) James is young and strong.
 d) Rita will move to Oregon or Washington.

You might also like