These lecture notes from a Discrete Structures course cover the process of translating English sentences into propositional logic. The notes include examples of converting English sentences into propositional logic using propositional variables and logical connectives. The document also covers the concept of logical equivalence and provides exercises for practice.
Download Discrete Structures Lecture Notes: Translating English Sentences into Propositional Logic and more Study notes Computer Science in PDF only on Docsity!
CSC102 - Discrete Structures By Mahwish Waqas
Department Of Computer Science, CUI
Lahore Campus
Lecture Outline
Applications of Propositional Logic
Logic and Bit Operations
Logical Equivalence
Translating English Sentences
Steps to convert an English sentence to a statement in propositional logic - Identify atomic propositions and represent using propositional variables. - Determine appropriate logical connectives
Translating English Sentences
“I have neither given nor received help on this exam” Let p = I have given help on this exam q = I have received help on this exam
Rephrase: It is not the case that either I have given or received help on this exams
Translating English Sentences
“If I go to Harry’s or to the country, I will not go shopping.”
Translating English Sentences
“If I go to Harry’s or to the country, I will not go shopping.”
Let p = I go to Harry’s
q = I go to the country.
r = I will go shopping.
Translating English Sentences
Let p = It is below freezing q = It is snowing a) It is below freezing and it is snowing b) It is below freezing but not snowing c) It is not below freezing and it is not snowing d) It is either snowing or below freezing (or both) e) If it is below freezing, it is also snowing f) It is either below freezing or it is snowing (not both), but it is not snowing if it is below freezing g) That it is below freezing is necessary and sufficient for it to be snowing
Translating English Sentences
“You can access the Internet from campus only if you are a computer science major or you are not a freshman.”
Translating English Sentences
“You can access the Internet from campus only if you are a computer science major or you are not a freshman.”
Let a = You can access the Internet from campus c = You are a computer science major and f = You are a freshman” respectively
a only if c or not f a → (c ∨¬f ).
Exercise
Let p and q be the propositions “The election is decided” and “The votes have been counted,” respectively. Express each of these compound propositions as an English sentence.
¬p
p ∨ q
¬p ∧ q
q → p
¬q → ¬p
¬p → ¬q
p ↔ q
¬q ∨ (p ∧ q)
System Specifications
System and Software engineers take requirements in English and express them in a precise specification language based on logic.
The automated reply cannot be sent when the file system is full p = The automated reply can be sent q = The system is full
Consistency
System specifications should be consistent , They should not contain conflicting requirements that could be used to derive a contradiction.
When specifications are not consistent, there would be no way to develop a system that satisfies all specifications.
A list of propositions is consistent if it is possible to assign truth values to the proposition variables so that each proposition is true.
Determine whether these system specifications are consistent:
The diagnostic message is stored in the buffer or it is retransmitted.
The diagnostic message is not stored in the buffer.
If the diagnostic message is stored in the buffer, then it is retransmitted.
p = The diagnostic message is stored in the buffer
q = The diagnostic message is retransmitted
𝒑∨𝒒 2. ¬𝒑 3. 𝒑→𝒒
Reasoning
An assignment of truth values that makes all three specifications true must have p false to make ¬𝑝 true.
Because we want 𝑝 ∨ 𝑞 to be true but 𝑝 must be false, q must be true.
Because 𝑝 → 𝑞 is true when 𝑝 is false and 𝑞 is true
we conclude that these specifications are consistent