Slides for a Course Based on the Text Discrete Mathematics & Its Applications (5th Edition) by Kenneth H. Rosen
Slides for a Course Based on the Text Discrete Mathematics & Its Applications (5th Edition) by Kenneth H. Rosen
Calculating Projections via Type CheckingDaisuke BEKKI
Bekki Daisuke and Miho Sato (2015).
A presentation in TYpe Theory and LExical Semantics (TYTLES) in the 27th European Summer School in Logic, Language and Information (ESSLLI 2015), Barcelona, Spain.
Calculating Projections via Type CheckingDaisuke BEKKI
Bekki Daisuke and Miho Sato (2015).
A presentation in TYpe Theory and LExical Semantics (TYTLES) in the 27th European Summer School in Logic, Language and Information (ESSLLI 2015), Barcelona, Spain.
RuleML2015: Binary Frontier-guarded ASP with Function SymbolsRuleML
It has been acknowledged that emerging Web applications
require features that are not available in standard rule languages like
Datalog or Answer Set Programming (ASP), e.g., they are not powerful
enough to deal with anonymous values (objects that are not explicitly
mentioned in the data but whose existence is implied by the background
knowledge). In this paper, we introduce a new rule language based on
ASP extended with function symbols, which can be used to reason about
anonymous values. In particular, we define binary frontier-guarded programs
(BFG programs) that allow for disjunction, function symbols, and
negation under the stable model semantics. In order to ensure decidability,
BFG programs are syntactically restricted by allowing at most
binary predicates and by requiring rules to be frontier-guarded. BFG programs
are expressive enough to simulate ontologies expressed in popular
Description Logics (DLs), capture their recent non-monotonic extensions,
and can simulate conjunctive query answering over many standard DLs.
We provide an elegant automata-based algorithm to reason in BFG programs,
which yields a 3ExpTime upper bound for reasoning tasks like
deciding consistency or cautious entailment. Due to existing results, these
problems are known to be 2ExpTime-hard.
Describes a natural language engine built in C# that provides a strongly-typed parser and rules engine. For more information please visit http://blog.abodit.com
Doppl is a new programming language that aims providing a natural syntax for implementing parallel algorithms, designing data structures for shared memory applications and automated message passing among multiple tasks. The name is an abbreviation of `data oriented parallel programming language`.
RuleML2015 The Herbrand Manifesto - Thinking Inside the Box RuleML
The traditional semantics for First Order Logic (sometimes called Tarskian semantics) is based on the notion of interpretations of constants. Herbrand semantics is an alternative semantics based directly on truth assignments for ground sentences rather than interpretations of constants. Herbrand semantics is simpler and more intuitive than Tarskian semantics; and, consequently, it is easier to teach and learn. Moreover, it is more expressive. For example, while it is not possible to finitely axiomatize integer arithmetic with Tarskian semantics, this can be done easily with Herbrand Semantics. The downside is a loss of some common logical properties, such as compactness and completeness. However, there is no loss of inferential power. Anything that can be proved according to Tarskian semantics can also be proved according to Herbrand semantics. In this presentation, we define Herbrand semantics; we look at the implications for research on logic and rules systems and automated reasoning; and and we assess the potential for popularizing logic.
RuleML2015: Binary Frontier-guarded ASP with Function SymbolsRuleML
It has been acknowledged that emerging Web applications
require features that are not available in standard rule languages like
Datalog or Answer Set Programming (ASP), e.g., they are not powerful
enough to deal with anonymous values (objects that are not explicitly
mentioned in the data but whose existence is implied by the background
knowledge). In this paper, we introduce a new rule language based on
ASP extended with function symbols, which can be used to reason about
anonymous values. In particular, we define binary frontier-guarded programs
(BFG programs) that allow for disjunction, function symbols, and
negation under the stable model semantics. In order to ensure decidability,
BFG programs are syntactically restricted by allowing at most
binary predicates and by requiring rules to be frontier-guarded. BFG programs
are expressive enough to simulate ontologies expressed in popular
Description Logics (DLs), capture their recent non-monotonic extensions,
and can simulate conjunctive query answering over many standard DLs.
We provide an elegant automata-based algorithm to reason in BFG programs,
which yields a 3ExpTime upper bound for reasoning tasks like
deciding consistency or cautious entailment. Due to existing results, these
problems are known to be 2ExpTime-hard.
Describes a natural language engine built in C# that provides a strongly-typed parser and rules engine. For more information please visit http://blog.abodit.com
Doppl is a new programming language that aims providing a natural syntax for implementing parallel algorithms, designing data structures for shared memory applications and automated message passing among multiple tasks. The name is an abbreviation of `data oriented parallel programming language`.
RuleML2015 The Herbrand Manifesto - Thinking Inside the Box RuleML
The traditional semantics for First Order Logic (sometimes called Tarskian semantics) is based on the notion of interpretations of constants. Herbrand semantics is an alternative semantics based directly on truth assignments for ground sentences rather than interpretations of constants. Herbrand semantics is simpler and more intuitive than Tarskian semantics; and, consequently, it is easier to teach and learn. Moreover, it is more expressive. For example, while it is not possible to finitely axiomatize integer arithmetic with Tarskian semantics, this can be done easily with Herbrand Semantics. The downside is a loss of some common logical properties, such as compactness and completeness. However, there is no loss of inferential power. Anything that can be proved according to Tarskian semantics can also be proved according to Herbrand semantics. In this presentation, we define Herbrand semantics; we look at the implications for research on logic and rules systems and automated reasoning; and and we assess the potential for popularizing logic.
Presentazione di Pierpaolo Basile, durante il suo talk dal titolo "Geometria e Semantica del Linguaggio.
L'incontro si è tenuto il giorno 17 Dicembre 2014 all'interno del progetto SSC (Scientific Storming Café).
L'abstract del talk è "Rappresentare concetti in uno spazio geometrico è una tecnica ampiamente utilizzata nell'informatica per modellare la semantica del linguaggio naturale. Ad esempio i motori di ricerca che interroghiamo ogni giorno utilizzano la geometria per rappresentare parole e documenti. Obiettivo del talk è introdurre i concetti di base dei modelli di semantica distribuzionale e presentare alcuni operatori geometrici per la composizione dei termini per rappresentare concetti più complessi come frasi o interi documenti"
How to Ground A Language for Legal Discourse In a Prototypical Perceptual Sem...L. Thorne McCarty
Slides for my talk at the 15th International Conference on Artificial Intelligence and Law (ICAIL 2015), June 11, 2015.
The full ICAIL 2015 paper is available on ResearchGate at bit.ly/1qCnLJq.
Building WordSpaces via Random Indexing from simple to complex spacesPierpaolo Basile
This presentation describes two approaches to compositional semantics in distributional semantic spaces.
Both approaches conceive the semantics of complex structures, such as phrases or sentences, as being other than
the sum of its terms.
Syntax is the plus used as a glue to compose words.
The former kind of approach encodes information about syntactic dependencies directly into distributional spaces, the latter exploits compositional operators reflecting the syntactic role of words.
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERSveerababupersonal22
It consists of cw radar and fmcw radar ,range measurement,if amplifier and fmcw altimeterThe CW radar operates using continuous wave transmission, while the FMCW radar employs frequency-modulated continuous wave technology. Range measurement is a crucial aspect of radar systems, providing information about the distance to a target. The IF amplifier plays a key role in signal processing, amplifying intermediate frequency signals for further analysis. The FMCW altimeter utilizes frequency-modulated continuous wave technology to accurately measure altitude above a reference point.
Welcome to WIPAC Monthly the magazine brought to you by the LinkedIn Group Water Industry Process Automation & Control.
In this month's edition, along with this month's industry news to celebrate the 13 years since the group was created we have articles including
A case study of the used of Advanced Process Control at the Wastewater Treatment works at Lleida in Spain
A look back on an article on smart wastewater networks in order to see how the industry has measured up in the interim around the adoption of Digital Transformation in the Water Industry.
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...ssuser7dcef0
Power plants release a large amount of water vapor into the
atmosphere through the stack. The flue gas can be a potential
source for obtaining much needed cooling water for a power
plant. If a power plant could recover and reuse a portion of this
moisture, it could reduce its total cooling water intake
requirement. One of the most practical way to recover water
from flue gas is to use a condensing heat exchanger. The power
plant could also recover latent heat due to condensation as well
as sensible heat due to lowering the flue gas exit temperature.
Additionally, harmful acids released from the stack can be
reduced in a condensing heat exchanger by acid condensation. reduced in a condensing heat exchanger by acid condensation.
Condensation of vapors in flue gas is a complicated
phenomenon since heat and mass transfer of water vapor and
various acids simultaneously occur in the presence of noncondensable
gases such as nitrogen and oxygen. Design of a
condenser depends on the knowledge and understanding of the
heat and mass transfer processes. A computer program for
numerical simulations of water (H2O) and sulfuric acid (H2SO4)
condensation in a flue gas condensing heat exchanger was
developed using MATLAB. Governing equations based on
mass and energy balances for the system were derived to
predict variables such as flue gas exit temperature, cooling
water outlet temperature, mole fraction and condensation rates
of water and sulfuric acid vapors. The equations were solved
using an iterative solution technique with calculations of heat
and mass transfer coefficients and physical properties.
Cosmetic shop management system project report.pdfKamal Acharya
Buying new cosmetic products is difficult. It can even be scary for those who have sensitive skin and are prone to skin trouble. The information needed to alleviate this problem is on the back of each product, but it's thought to interpret those ingredient lists unless you have a background in chemistry.
Instead of buying and hoping for the best, we can use data science to help us predict which products may be good fits for us. It includes various function programs to do the above mentioned tasks.
Data file handling has been effectively used in the program.
The automated cosmetic shop management system should deal with the automation of general workflow and administration process of the shop. The main processes of the system focus on customer's request where the system is able to search the most appropriate products and deliver it to the customers. It should help the employees to quickly identify the list of cosmetic product that have reached the minimum quantity and also keep a track of expired date for each cosmetic product. It should help the employees to find the rack number in which the product is placed.It is also Faster and more efficient way.
Saudi Arabia stands as a titan in the global energy landscape, renowned for its abundant oil and gas resources. It's the largest exporter of petroleum and holds some of the world's most significant reserves. Let's delve into the top 10 oil and gas projects shaping Saudi Arabia's energy future in 2024.
HEAP SORT ILLUSTRATED WITH HEAPIFY, BUILD HEAP FOR DYNAMIC ARRAYS.
Heap sort is a comparison-based sorting technique based on Binary Heap data structure. It is similar to the selection sort where we first find the minimum element and place the minimum element at the beginning. Repeat the same process for the remaining elements.
We have compiled the most important slides from each speaker's presentation. This year’s compilation, available for free, captures the key insights and contributions shared during the DfMAy 2024 conference.
Final project report on grocery store management system..pdfKamal Acharya
In today’s fast-changing business environment, it’s extremely important to be able to respond to client needs in the most effective and timely manner. If your customers wish to see your business online and have instant access to your products or services.
Online Grocery Store is an e-commerce website, which retails various grocery products. This project allows viewing various products available enables registered users to purchase desired products instantly using Paytm, UPI payment processor (Instant Pay) and also can place order by using Cash on Delivery (Pay Later) option. This project provides an easy access to Administrators and Managers to view orders placed using Pay Later and Instant Pay options.
In order to develop an e-commerce website, a number of Technologies must be studied and understood. These include multi-tiered architecture, server and client-side scripting techniques, implementation technologies, programming language (such as PHP, HTML, CSS, JavaScript) and MySQL relational databases. This is a project with the objective to develop a basic website where a consumer is provided with a shopping cart website and also to know about the technologies used to develop such a website.
This document will discuss each of the underlying technologies to create and implement an e- commerce website.
Understanding Inductive Bias in Machine LearningSUTEJAS
This presentation explores the concept of inductive bias in machine learning. It explains how algorithms come with built-in assumptions and preferences that guide the learning process. You'll learn about the different types of inductive bias and how they can impact the performance and generalizability of machine learning models.
The presentation also covers the positive and negative aspects of inductive bias, along with strategies for mitigating potential drawbacks. We'll explore examples of how bias manifests in algorithms like neural networks and decision trees.
By understanding inductive bias, you can gain valuable insights into how machine learning models work and make informed decisions when building and deploying them.
1. 03/07/17 1
Module #1 - Logic
North South University
Dept. of Computer Science & Engineering
CSE 173
Discrete Mathematics
Dr. Mohammad R. Rahman
Slides for a Course Based on the TextSlides for a Course Based on the Text
Discrete Mathematics & Its ApplicationsDiscrete Mathematics & Its Applications
(5(5thth
Edition)Edition)
by Kenneth H. Rosenby Kenneth H. Rosen
3. 03/07/17 3
Module #1 - Logic
Module #1: Foundations of Logic
(§§1.1-1.4)
Mathematical Logic is a tool for working with
elaborate compound statements. It includes:
• A formal language for expressing them.
• A concise notation for writing them.
• A methodology for objectively reasoning about
their truth or falsity.
• It is the foundation for expressing formal proofs in
all branches of mathematics.
5. 03/07/17 5
Module #1 - Logic
Propositional Logic (§1.1)
Propositional LogicPropositional Logic is the logic of compoundis the logic of compound
statements built from simpler statementsstatements built from simpler statements
using so-calledusing so-called BooleanBoolean connectives.connectives.
Some applications in computer science:Some applications in computer science:
• Design of digital electronic circuits.Design of digital electronic circuits.
• Expressing conditions in programs.Expressing conditions in programs.
• Queries to databases & search engines.Queries to databases & search engines.
Topic #1 – Propositional Logic
George Boole
(1815-1864)
Chrysippus of Soli
(ca. 281 B.C. – 205 B.C.)
6. 03/07/17 6
Module #1 - Logic
Definition of a Proposition
Definition:Definition: AA propositionproposition (denoted(denoted pp,, qq,, rr, …) is simply:, …) is simply:
• aa statementstatement ((i.e.i.e., a declarative sentence), a declarative sentence)
– with some definite meaningwith some definite meaning, (not vague or ambiguous), (not vague or ambiguous)
• having ahaving a truth valuetruth value that’s eitherthat’s either truetrue ((TT) or) or falsefalse ((FF))
– it isit is nevernever both, neither, or somewhere “in between!”both, neither, or somewhere “in between!”
• However, you might notHowever, you might not knowknow the actual truth value,the actual truth value,
• and, the truth value mightand, the truth value might dependdepend on the situation or context.on the situation or context.
• However with probability theory,However with probability theory, we assignwe assign degrees of certaintydegrees of certainty
(“between”(“between” TT andand FF) to propositions.) to propositions.
– But for now: think True/False only!But for now: think True/False only!
Topic #1 – Propositional Logic
7. 03/07/17 7
Module #1 - Logic
Examples of Propositions
• ““It is raining.”It is raining.” (In a given situation.)(In a given situation.)
• ““Beijing is the capital of China.” • “1 + 2 = 3”Beijing is the capital of China.” • “1 + 2 = 3”
But, the following areBut, the following are NOTNOT propositions:propositions:
• ““Who’s there?”Who’s there?” (interrogative, question)(interrogative, question)
• ““La la la la la.”La la la la la.” (meaningless interjection)(meaningless interjection)
• ““Just do it!”Just do it!” (imperative, command)(imperative, command)
• ““Yeah, I sorta dunno, whatever...”Yeah, I sorta dunno, whatever...” (vague)(vague)
• ““1 + 2”1 + 2” (expression with a non-true/false value)(expression with a non-true/false value)
Topic #1 – Propositional Logic
8. 03/07/17 8
Module #1 - Logic
AnAn operatoroperator oror connectiveconnective combines one orcombines one or
moremore operandoperand expressions into a largerexpressions into a larger
expression. (expression. (E.g.E.g., “+” in numeric exprs.), “+” in numeric exprs.)
• UnaryUnary operators take 1 operand (operators take 1 operand (e.g.,e.g., −−3);3);
binarybinary operators take 2 operands (operators take 2 operands (egeg 33 ×× 4).4).
• PropositionalPropositional oror BooleanBoolean operatorsoperators operateoperate
on propositionson propositions (or their truth values)(or their truth values)
instead of on numbers.instead of on numbers.
Operators / Connectives
Topic #1.0 – Propositional Logic: Operators
10. 03/07/17 10
Module #1 - Logic
The Negation Operator
The unaryThe unary negation operatornegation operator “¬” (“¬” (NOTNOT))
transforms a prop. into its logicaltransforms a prop. into its logical negationnegation..
E.g.E.g. IfIf pp = “I have brown hair.”= “I have brown hair.”
then ¬then ¬pp = “I do= “I do notnot have brown hair.”have brown hair.”
TheThe truth tabletruth table for NOT:for NOT: p ¬p
T F
F T
T :≡ True; F :≡ False
“:≡” means “is defined as”
Operand
column
Result
column
Topic #1.0 – Propositional Logic: Operators
11. 03/07/17 11
Module #1 - Logic
The Conjunction Operator
The binaryThe binary conjunction operatorconjunction operator ““∧∧” (” (ANDAND))
combines two propositions to form theircombines two propositions to form their
logicallogical conjunctionconjunction..
E.g.E.g. IfIf pp=“I will have salad for lunch.” and=“I will have salad for lunch.” and
q=q=“I will have steak for dinner.”, then“I will have steak for dinner.”, then
pp∧∧qq=“I will have salad for lunch=“I will have salad for lunch andand
I will have steak for dinner.”I will have steak for dinner.”
Remember: “∧∧” points up like an “A”, and it means “” points up like an “A”, and it means “∧∧NDND””
∧∧NDND
Topic #1.0 – Propositional Logic: Operators
12. 03/07/17 12
Module #1 - Logic
• Note that aNote that a
conjunctionconjunction
pp11 ∧∧ pp22 ∧∧ …… ∧∧ ppnn
ofof nn propositionspropositions
will have 2will have 2nn
rowsrows
in its truth table.in its truth table.
• Also: ¬ andAlso: ¬ and ∧∧ operations together are suffi-operations together are suffi-
cient to expresscient to express anyany Boolean truth table!Boolean truth table!
Conjunction Truth Table
p q p∧q
F F F
F T F
T F F
T T T
Operand columns
Topic #1.0 – Propositional Logic: Operators
13. 03/07/17 13
Module #1 - Logic
The Disjunction Operator
The binaryThe binary disjunction operatordisjunction operator ““∨∨” (” (OROR))
combines two propositions to form theircombines two propositions to form their
logicallogical disjunctiondisjunction..
pp=“My car has a bad engine.”=“My car has a bad engine.”
q=q=“My car has a bad carburetor.”“My car has a bad carburetor.”
pp∨∨qq=“Either my car has a bad engine,=“Either my car has a bad engine, oror
my car has a bad carburetor.”my car has a bad carburetor.” After the downward-
pointing “axe” of “∨∨””
splits the wood, yousplits the wood, you
can take 1 piece OR thecan take 1 piece OR the
other, or both.other, or both.
∨∨
Topic #1.0 – Propositional Logic: Operators
Meaning is like “and/or” in English.
14. 03/07/17 14
Module #1 - Logic
• Note thatNote that pp∨∨qq meansmeans
thatthat pp is true, oris true, or qq isis
true,true, or bothor both are true!are true!
• So, this operation isSo, this operation is
also calledalso called inclusive or,inclusive or,
because itbecause it includesincludes thethe
possibility that bothpossibility that both pp andand qq are true.are true.
• ““¬” and “¬” and “∨∨” together are also universal.” together are also universal.
Disjunction Truth Table
p q p∨ q
F F F
F T T
T F T
T T T
Note
difference
from AND
Topic #1.0 – Propositional Logic: Operators
15. 03/07/17 15
Module #1 - Logic
Nested Propositional Expressions
• Use parentheses toUse parentheses to group sub-expressionsgroup sub-expressions::
““I just saw my oldI just saw my old ffriendriend, and either, and either he’she’s
ggrownrown oror I’veI’ve sshrunkhrunk.” =.” = ff ∧∧ ((gg ∨∨ ss))
– ((ff ∧∧ gg)) ∨∨ ss would mean something differentwould mean something different
– ff ∧∧ gg ∨∨ ss would be ambiguouswould be ambiguous
• By convention, “¬” takesBy convention, “¬” takes precedenceprecedence overover
both “both “∧∧” and “” and “∨∨”.”.
– ¬¬ss ∧∧ ff means (¬means (¬ss)) ∧∧ ff ,, notnot ¬ (¬ (ss ∧∧ ff))
Topic #1.0 – Propositional Logic: Operators
16. 03/07/17 16
Module #1 - Logic
A Simple Exercise
LetLet pp=“It rained last night”,=“It rained last night”,
qq=“The sprinklers came on last night,”=“The sprinklers came on last night,”
rr=“The lawn was wet this morning.”=“The lawn was wet this morning.”
Translate each of the following into English:Translate each of the following into English:
¬¬pp ==
rr ∧∧ ¬¬pp ==
¬¬ rr ∨∨ pp ∨∨ q =q =
“It didn’t rain last night.”
“The lawn was wet this morning, and
it didn’t rain last night.”
“Either the lawn wasn’t wet this
morning, or it rained last night, or
the sprinklers came on last night.”
Topic #1.0 – Propositional Logic: Operators
17. 03/07/17 17
Module #1 - Logic
The Exclusive Or Operator
The binaryThe binary exclusive-or operatorexclusive-or operator ““⊕⊕” (” (XORXOR))
combines two propositions to form theircombines two propositions to form their
logical “exclusive or” (exjunction?).logical “exclusive or” (exjunction?).
pp = “I will earn an A in this course,”= “I will earn an A in this course,”
qq == “I will drop this course,”“I will drop this course,”
pp ⊕⊕ qq = “I will either earn an A in this course,= “I will either earn an A in this course,
or I will drop it (but not both!)”or I will drop it (but not both!)”
Topic #1.0 – Propositional Logic: Operators
18. 03/07/17 18
Module #1 - Logic
• Note thatNote that pp⊕⊕qq meansmeans
thatthat pp is true, oris true, or qq isis
true, buttrue, but not bothnot both!!
• This operation isThis operation is
calledcalled exclusive or,exclusive or,
because itbecause it excludesexcludes thethe
possibility that bothpossibility that both pp andand qq are true.are true.
• ““¬” and “¬” and “⊕⊕” together are” together are notnot universal.universal.
Exclusive-Or Truth Table
p q p⊕ q
F F F
F T T
T F T
T T F Note
difference
from OR.
Topic #1.0 – Propositional Logic: Operators
19. 03/07/17 19
Module #1 - Logic
Note thatNote that EnglishEnglish “or” can be“or” can be ambiguousambiguous
regarding the “both” case!regarding the “both” case!
““Pat is a singer orPat is a singer or
Pat is a writer.” -Pat is a writer.” -
““Pat is a man orPat is a man or
Pat is a woman.” -Pat is a woman.” -
Need context to disambiguate the meaning!Need context to disambiguate the meaning!
For this class, assume “or” meansFor this class, assume “or” means inclusiveinclusive..
Natural Language is Ambiguous
p q p "or" q
F F F
F T T
T F T
T T ?
∨
⊕
Topic #1.0 – Propositional Logic: Operators
20. 03/07/17 20
Module #1 - Logic
The Implication Operator
TheThe implicationimplication pp →→ qq states thatstates that pp impliesimplies q.q.
I.e.I.e., If, If pp is true, thenis true, then qq is true; but ifis true; but if pp is notis not
true, thentrue, then qq could be either true or false.could be either true or false.
E.g.E.g., let, let pp = “You study hard.”= “You study hard.”
qq = “You will get a good grade.”= “You will get a good grade.”
pp →→ q =q = “If you study hard, then you will get“If you study hard, then you will get
a good grade.”a good grade.” (else, it could go either way)(else, it could go either way)
Topic #1.0 – Propositional Logic: Operators
antecedent consequent
21. 03/07/17 21
Module #1 - Logic
Implication Truth Table
• pp →→ qq isis falsefalse onlyonly whenwhen
pp is true butis true but qq isis notnot true.true.
• pp →→ qq doesdoes notnot saysay
thatthat pp causescauses qq!!
• pp →→ qq doesdoes notnot requirerequire
thatthat pp oror qq are ever trueare ever true!!
• E.g.E.g. “(1=0)“(1=0) →→ pigs can fly” is TRUE!pigs can fly” is TRUE!
p q p→q
F F T
F T T
T F F
T T T
The
only
False
case!
Topic #1.0 – Propositional Logic: Operators
22. 03/07/17 22
Module #1 - Logic
Examples of Implications
• ““If this lecture ever ends, then the sun willIf this lecture ever ends, then the sun will
rise tomorrow.”rise tomorrow.” TrueTrue oror FalseFalse??
• ““If Tuesday is a day of the week, then I amIf Tuesday is a day of the week, then I am
a penguin.”a penguin.” TrueTrue oror FalseFalse??
• ““If 1+1=6, then Bush is president.”If 1+1=6, then Bush is president.”
TrueTrue oror FalseFalse??
• ““If the moon is made of green cheese, then IIf the moon is made of green cheese, then I
am richer than Bill Gates.”am richer than Bill Gates.” TrueTrue oror FalseFalse??
Topic #1.0 – Propositional Logic: Operators
23. 03/07/17 23
Module #1 - Logic
Difference between English
Language and Logic
• The way we have defined implications is more generalThe way we have defined implications is more general
than the meaning attached to English Language.than the meaning attached to English Language.
• Consider a sentence like,Consider a sentence like,
– ““If it is sunny today, then we will go to beach”If it is sunny today, then we will go to beach”
• In normal language there is a relationship betweenIn normal language there is a relationship between
antecedent and consequent.antecedent and consequent.
• Now Let us consider this exampleNow Let us consider this example
– ““If it is Friday, then 2+3=5”If it is Friday, then 2+3=5”
• In logic, we consider the sentenceIn logic, we consider the sentence TrueTrue since thesince the
conclusion is trueconclusion is true
24. 03/07/17 24
Module #1 - Logic
More about Discrepancy
• In English, a sentence “ifIn English, a sentence “if pp thenthen qq” usually really” usually really
implicitlyimplicitly means something like,means something like,
• ““In all possible situationsIn all possible situations, if, if pp thenthen qq.”.”
– That is, “ForThat is, “For pp to be true andto be true and qq false isfalse is impossibleimpossible.”.”
– Or, “IOr, “I guaranteeguarantee that no matter what, ifthat no matter what, if pp, then, then qq.”.”
• In mathematical concept of an implication isIn mathematical concept of an implication is
independent of a cause and effect relationshipindependent of a cause and effect relationship
between hypothesis and conclusionbetween hypothesis and conclusion
• The implication only specifies the truth values; it isThe implication only specifies the truth values; it is
not based on English usage.not based on English usage.
25. 03/07/17 25
Module #1 - Logic
English Phrases Meaning p → q
• ““pp impliesimplies qq””
• ““ifif pp, then, then qq””
• ““ifif pp,, qq””
• ““whenwhen pp,, qq””
• ““wheneverwhenever pp,, qq””
• ““qq ifif pp””
• ““qq whenwhen pp””
• ““qq wheneverwhenever pp””
• ““pp only ifonly if qq””
• ““pp is sufficient foris sufficient for qq””
• ““qq is necessary foris necessary for pp””
• ““qq follows fromfollows from pp””
• ““qq is implied byis implied by pp””
We will see some equivalentWe will see some equivalent
logic expressions later.logic expressions later.
Topic #1.0 – Propositional Logic: Operators
26. 03/07/17 26
Module #1 - Logic
Converse, Inverse, Contrapositive
Some terminology, for an implicationSome terminology, for an implication pp →→ qq::
• ItsIts converseconverse is:is: qq →→ pp..
• ItsIts inverseinverse is:is: ¬¬pp →→ ¬¬qq..
• ItsIts contrapositivecontrapositive:: ¬¬qq →→ ¬¬ p.p.
• One of these three has theOne of these three has the same meaningsame meaning
(same truth table) as(same truth table) as pp →→ qq. Can you figure. Can you figure
out which?out which?
Topic #1.0 – Propositional Logic: Operators
27. 03/07/17 27
Module #1 - Logic
How do we know for sure?
Proving the equivalence ofProving the equivalence of pp →→ qq and itsand its
contrapositive using truth tables:contrapositive using truth tables:
p q ¬q ¬p p→q ¬q →¬p
F F T T T T
F T F T T T
T F T F F F
T T F F T T
Topic #1.0 – Propositional Logic: Operators
28. 03/07/17 28
Module #1 - Logic
The biconditional operator
• TheThe biconditionalbiconditional pp ↔ qq is theis the
proposition that is true when p andproposition that is true when p and
q have the same truth values, and isq have the same truth values, and is
false otherwise.false otherwise.
• pp ↔ qq is true preciously when bothis true preciously when both
the implicationsthe implications
pp →→ qq andand qq →→ pp are trueare true
• The terminology “if and only if q”The terminology “if and only if q”
is used foris used for pp ↔ qq
Topic #1.0 – Propositional Logic: Operators
p q p ↔q
F F T
F T F
T F F
T T T
29. 03/07/17 29
Module #1 - Logic
Biconditional Truth Table
• pp ↔ qq means thatmeans that pp andand qq
have thehave the samesame truth value.truth value.
• Note this truth table is theNote this truth table is the
exactexact oppositeopposite ofof ⊕⊕’s!’s!
Thus,Thus, pp ↔ qq means ¬(means ¬(pp ⊕⊕ qq))
• pp ↔ qq doesdoes notnot implyimply
thatthat pp andand qq are true, or that either of them causesare true, or that either of them causes
the other, or that they have a common cause.the other, or that they have a common cause.
Topic #1.0 – Propositional Logic: Operators
p q p ↔q
F F T
F T F
T F F
T T T
30. 03/07/17 30
Module #1 - Logic
English Equivalent
• ““p is necessary and sufficient for q”p is necessary and sufficient for q”
• ““if p then q, and conversely.”if p then q, and conversely.”
• ““p iff q”p iff q”
• Example: p: You can take the flight and q:Example: p: You can take the flight and q:
You buy a ticketYou buy a ticket
• pp ↔ q: “ You can take the flight if and onlyq: “ You can take the flight if and only
if you buy a ticket”if you buy a ticket”
31. 03/07/17 31
Module #1 - Logic
Translating English Sentences
1.1. You can access the Internet from campusYou can access the Internet from campus
only if you are a computer science majoronly if you are a computer science major
or you are not a freshman.or you are not a freshman.
2.2. You cannot ride the roller coaster if youYou cannot ride the roller coaster if you
are under 4 feet tall unless you are olderare under 4 feet tall unless you are older
than 16 years old.than 16 years old.
3.3. The automated reply cannot be sent whenThe automated reply cannot be sent when
the file system is full.the file system is full.
32. 03/07/17 32
Module #1 - Logic
System Specifications
• System and software engineers take requirements inSystem and software engineers take requirements in
natural language and produce precise and unambiguousnatural language and produce precise and unambiguous
specifications that could be used as the basis of systemspecifications that could be used as the basis of system
development.development.
• System specifications should not contain conflictingSystem specifications should not contain conflicting
requirements.requirements.
• Propositional expressions representing these specificationsPropositional expressions representing these specifications
need to beneed to be consistentconsistent ::
• there must be an assignment of truth values to the variablethere must be an assignment of truth values to the variable
in the expressions that makes all the expressions truein the expressions that makes all the expressions true
33. 03/07/17 33
Module #1 - Logic
Example: System Specifications
Are the system specifications consistent?Are the system specifications consistent?
• The diagnostic message is stored in theThe diagnostic message is stored in the
buffer or it is retransmittedbuffer or it is retransmitted
• The diagnostic message is not stored in theThe diagnostic message is not stored in the
buffer.buffer.
• If the diagnostic message is stored in theIf the diagnostic message is stored in the
buffer, then it is retransmitted.buffer, then it is retransmitted.
34. 03/07/17 34
Module #1 - Logic
Some Alternative Notations
Name: not and or xor implies iff
Propositional logic: ¬∧ ∨ ⊕ → ↔
Boolean algebra: p pq + ⊕
C/C++/Java (wordwise): ! && || != ==
C/C++/Java (bitwise): ~ & | ^
Logic gates:
Topic #1.0 – Propositional Logic: Operators
35. 03/07/17 35
Module #1 - Logic
Bits and Bit Operations
• AA bitbit is ais a bibinary (base 2) dignary (base 2) digitit: 0 or 1.: 0 or 1.
• Bits may be used to represent truth values.Bits may be used to represent truth values.
• By convention:By convention:
0 represents “false”; 1 represents “true”.0 represents “false”; 1 represents “true”.
• Boolean algebraBoolean algebra is like ordinary algebrais like ordinary algebra
except that variables stand for bits, + meansexcept that variables stand for bits, + means
“or”, and multiplication means “and”.“or”, and multiplication means “and”.
Topic #2 – Bits
John Tukey
(1915-2000)
36. 03/07/17 36
Module #1 - Logic
Bitwise Operations
• Boolean operations can be extended toBoolean operations can be extended to
operate on bit strings as well as single bits.operate on bit strings as well as single bits.
• E.g.:E.g.:
01 1011 011001 1011 0110
11 0001 110111 0001 1101
11 1011 1111 Bit-wise ORBit-wise OR
01 0001 0100 Bit-wise ANDBit-wise AND
10 1010 1011 Bit-wise XORBit-wise XOR
Topic #2 – Bits
37. 03/07/17 37
Module #1 - Logic
End of §1.1
You have learned about:You have learned about:
• Propositions: WhatPropositions: What
they are.they are.
• Propositional logicPropositional logic
operators’operators’
– Symbolic notations.Symbolic notations.
– English equivalents.English equivalents.
– Logical meaning.Logical meaning.
– Truth tables.Truth tables.
• Atomic vs. compoundAtomic vs. compound
propositions.propositions.
• Alternative notations.Alternative notations.
• Bits and bit-strings.Bits and bit-strings.
• Next section: §1.2Next section: §1.2
– PropositionalPropositional
equivalences.equivalences.
– How to prove them.How to prove them.
38. 03/07/17 38
Module #1 - Logic
Propositional Equivalence (§1.2)
TwoTwo syntacticallysyntactically ((i.e.,i.e., textually) differenttextually) different
compound propositions may be thecompound propositions may be the
semanticallysemantically identical (identical (i.e.,i.e., have the samehave the same
meaning). We call themmeaning). We call them equivalentequivalent. Learn:. Learn:
• VariousVarious equivalence rulesequivalence rules oror lawslaws..
• How toHow to proveprove equivalences usingequivalences using symbolicsymbolic
derivationsderivations..
Topic #1.1 – Propositional Logic: Equivalences
39. 03/07/17 39
Module #1 - Logic
Tautologies and Contradictions
AA tautologytautology is a compound proposition that isis a compound proposition that is
truetrue no matter whatno matter what the truth values of itsthe truth values of its
atomic propositions are!atomic propositions are!
Ex.Ex. pp ∨∨ ¬¬pp [What is its truth table?][What is its truth table?]
AA contradictioncontradiction is a compound propositionis a compound proposition
that isthat is falsefalse no matter what!no matter what! Ex.Ex. pp ∧∧ ¬¬pp
[Truth table?][Truth table?]
Other compound props. areOther compound props. are contingenciescontingencies..
Topic #1.1 – Propositional Logic: Equivalences
40. 03/07/17 40
Module #1 - Logic
Logical Equivalence
Compound propositionCompound proposition pp isis logicallylogically
equivalentequivalent to compound propositionto compound proposition qq,,
writtenwritten pp⇔⇔qq,, IFFIFF the compoundthe compound
propositionproposition pp↔↔qq is a tautology.is a tautology.
Compound propositionsCompound propositions pp andand qq are logicallyare logically
equivalent to each otherequivalent to each other IFFIFF pp andand qq
contain the same truth values as each othercontain the same truth values as each other
inin allall rows of their truth tables.rows of their truth tables.
Topic #1.1 – Propositional Logic: Equivalences
41. 03/07/17 41
Module #1 - Logic
Ex.Ex. Prove thatProve that pp∨∨qq ⇔⇔ ¬¬((¬¬pp ∧∧ ¬¬qq).).
p q pp∨∨qq ¬¬pp ¬¬qq ¬¬pp ∧∧¬¬qq ¬¬((¬¬pp ∧∧¬¬qq))
F F
F T
T F
T T
Proving Equivalence
via Truth Tables
F
T
T
T
T
T
T
T
T
T
F
F
F
F
F
F
F
F
T
T
Topic #1.1 – Propositional Logic: Equivalences
49. 03/07/17 49
Module #1 - Logic
Predicate Logic (§1.3)
• Predicate logicPredicate logic is an extension ofis an extension of
propositional logic that permits conciselypropositional logic that permits concisely
reasoning about wholereasoning about whole classesclasses of entities.of entities.
• Propositional logic (recall) treats simplePropositional logic (recall) treats simple
propositionspropositions (sentences) as atomic entities.(sentences) as atomic entities.
• In contrast,In contrast, predicatepredicate logic distinguishes thelogic distinguishes the
subjectsubject of a sentence from itsof a sentence from its predicate.predicate.
– Remember these English grammar terms?Remember these English grammar terms?
Topic #3 – Predicate Logic
50. 03/07/17 50
Module #1 - Logic
Subjects and Predicates
• In the sentence “The dog is sleeping”:In the sentence “The dog is sleeping”:
– The phrase “the dog” denotes theThe phrase “the dog” denotes the subjectsubject --
thethe objectobject oror entityentity that the sentence is about.that the sentence is about.
– The phrase “is sleeping” denotes theThe phrase “is sleeping” denotes the predicatepredicate--
a property that is truea property that is true ofof the subject.the subject.
• In predicate logic, aIn predicate logic, a predicatepredicate is modeled asis modeled as
aa functionfunction PP(·) from objects to propositions.(·) from objects to propositions.
– PP((xx) = “) = “xx is sleeping” (whereis sleeping” (where xx is any object).is any object).
Topic #3 – Predicate Logic
51. 03/07/17 51
Module #1 - Logic
More About Predicates
• Convention: Lowercase variablesConvention: Lowercase variables xx,, yy,, z...z... denotedenote
objects/entities; uppercase variablesobjects/entities; uppercase variables PP,, QQ,, RR……
denote propositional functions (predicates).denote propositional functions (predicates).
• Keep in mind that theKeep in mind that the result ofresult of applyingapplying aa
predicatepredicate PP to an objectto an object xx is theis the proposition Pproposition P((xx).).
But the predicateBut the predicate PP itselfitself ((e.g. Pe.g. P=“is sleeping”) is=“is sleeping”) is
notnot a proposition (not a complete sentence).a proposition (not a complete sentence).
– E.g.E.g. ifif PP((xx) = “) = “xx is a prime number”,is a prime number”,
PP(3) is the(3) is the propositionproposition “3 is a prime number.”“3 is a prime number.”
Topic #3 – Predicate Logic
52. 03/07/17 52
Module #1 - Logic
Propositional Functions
• Predicate logicPredicate logic generalizesgeneralizes the grammaticalthe grammatical
notion of a predicate to also includenotion of a predicate to also include
propositional functions ofpropositional functions of anyany number ofnumber of
arguments, each of which may takearguments, each of which may take anyany
grammatical role that a noun can take.grammatical role that a noun can take.
– E.g.E.g. letlet PP((xx,,y,zy,z) = “) = “xx gavegave yy the gradethe grade zz”, then if”, then if
x=x=“Mike”,“Mike”, yy=“Mary”,=“Mary”, zz=“A”, then=“A”, then PP((xx,,yy,,zz) =) =
“Mike gave Mary the grade A.”“Mike gave Mary the grade A.”
Topic #3 – Predicate Logic
53. 03/07/17 53
Module #1 - Logic
Universes of Discourse (U.D.s)
• The power of distinguishing objects fromThe power of distinguishing objects from
predicates is that it lets you state thingspredicates is that it lets you state things
aboutabout manymany objects at once.objects at once.
• E.g., letE.g., let PP((xx)=“)=“xx+1>+1>xx”. We can then say,”. We can then say,
“For“For anyany numbernumber xx,, PP((xx) is true” instead of) is true” instead of
((00+1>+1>00)) ∧∧ ((11+1>+1>11)) ∧∧ ((22+1>+1>22)) ∧∧ ......
• The collection of values that a variableThe collection of values that a variable xx
can take is calledcan take is called xx’s’s universe of discourseuniverse of discourse..
Topic #3 – Predicate Logic
54. 03/07/17 54
Module #1 - Logic
Quantifier Expressions
• QuantifiersQuantifiers provide a notation that allowsprovide a notation that allows
us tous to quantifyquantify (count)(count) how manyhow many objects inobjects in
the univ. of disc. satisfy a given predicate.the univ. of disc. satisfy a given predicate.
• ““∀∀”” is the FORis the FOR∀∀LL orLL or universaluniversal quantifier.quantifier.
∀∀xx PP((xx) means) means for allfor all x in the u.d.,x in the u.d., PP holds.holds.
• ““∃∃”” is theis the ∃∃XISTS orXISTS or existentialexistential quantifier.quantifier.
∃∃x Px P((xx) means) means therethere existsexists anan xx in the u.d.in the u.d.
(that is, 1 or more)(that is, 1 or more) such thatsuch that PP((xx) is true.) is true.
Topic #3 – Predicate Logic
55. 03/07/17 55
Module #1 - Logic
The Universal Quantifier ∀
• Example:Example:
Let the u.d. of x beLet the u.d. of x be parking spaces at NSUparking spaces at NSU..
LetLet PP((xx) be the) be the predicatepredicate ““xx is full.”is full.”
Then theThen the universal quantification of Puniversal quantification of P((xx),),
∀∀xx PP((xx), is the), is the proposition:proposition:
– ““All parking spaces at NSU are full.”All parking spaces at NSU are full.”
– i.e.i.e., “Every parking space at NSU is full.”, “Every parking space at NSU is full.”
– i.e.i.e., “For each parking space at NSU, that space is full.”, “For each parking space at NSU, that space is full.”
Topic #3 – Predicate Logic
56. 03/07/17 56
Module #1 - Logic
The Existential Quantifier ∃
• Example:Example:
Let the u.d. of x beLet the u.d. of x be parking spaces at NSUparking spaces at NSU..
LetLet PP((xx) be the) be the predicatepredicate ““xx is full.”is full.”
Then theThen the existential quantification of Pexistential quantification of P((xx),),
∃∃xx PP((xx), is the), is the propositionproposition::
– ““Some parking space at NSU is full.”Some parking space at NSU is full.”
– ““There is a parking space at NSU that is full.”There is a parking space at NSU that is full.”
– ““At least one parking space at NSU is full.”At least one parking space at NSU is full.”
Topic #3 – Predicate Logic
57. 03/07/17 57
Module #1 - Logic
Quantifier Equivalence Laws
• Definitions of quantifiers: If u.d.=a,b,c,…Definitions of quantifiers: If u.d.=a,b,c,…
∀∀x Px P((xx)) ⇔⇔ PP(a)(a) ∧∧ PP(b)(b) ∧∧ PP(c)(c) ∧∧ ……
∃∃x Px P((xx)) ⇔⇔ PP(a)(a) ∨∨ PP(b)(b) ∨∨ PP(c)(c) ∨∨ ……
• From those, we can prove the laws:From those, we can prove the laws:
¬∀¬∀x Px P((xx)) ⇔⇔ ∃∃xx ¬¬PP((xx))
¬∃¬∃x Px P((xx)) ⇔⇔ ∀∀xx ¬¬PP((xx))
• WhichWhich propositionalpropositional equivalence laws canequivalence laws can
be used to prove this?be used to prove this?
Topic #3 – Predicate Logic
58. 03/07/17 58
Module #1 - Logic
Free and Bound Variables
• An expression likeAn expression like PP((xx) is said to have a) is said to have a
free variablefree variable xx (meaning,(meaning, xx is undefined).is undefined).
• A quantifier (eitherA quantifier (either ∀∀ oror ∃∃)) operatesoperates on anon an
expression having one or more freeexpression having one or more free
variables, andvariables, and bindsbinds one or more of thoseone or more of those
variables, to produce an expression havingvariables, to produce an expression having
one or moreone or more boundbound variablesvariables..
Topic #3 – Predicate Logic
59. 03/07/17 59
Module #1 - Logic
Example of Binding
• PP((x,yx,y) has 2 free variables,) has 2 free variables, xx andand yy..
∀ ∀∀xx PP((xx,,yy) has 1 free variable, and one bound) has 1 free variable, and one bound
variable.variable. [Which is which?][Which is which?]
• ““PP((xx), where), where xx=3” is another way to bind=3” is another way to bind xx..
• An expression withAn expression with zerozero free variables is a bona-free variables is a bona-
fide (actual) proposition.fide (actual) proposition.
• An expression withAn expression with one or moreone or more free variables isfree variables is
still only a predicate:still only a predicate: e.g.e.g. letlet QQ((yy) =) = ∀∀xx PP((xx,,yy))
Topic #3 – Predicate Logic
60. 03/07/17 60
Module #1 - Logic
Nesting of Quantifiers
Example: Let the u.d. ofExample: Let the u.d. of xx && yy be people.be people.
LetLet LL((xx,,yy)=“)=“xx likeslikes yy”” (a predicate w. 2 f.v.’s)(a predicate w. 2 f.v.’s)
ThenThen ∃∃y Ly L((x,yx,y) = “There is someone whom) = “There is someone whom xx
likes.”likes.” (A predicate w. 1 free variable,(A predicate w. 1 free variable, xx))
ThenThen ∀∀xx ((∃∃y Ly L((x,yx,y)) =)) =
“Everyone has someone whom they like.”“Everyone has someone whom they like.”
(A __________ with ___ free variables.)(A __________ with ___ free variables.)
Topic #3 – Predicate Logic
61. 03/07/17 61
Module #1 - Logic
Quantifier Exercise
IfIf RR((xx,,yy)=“)=“xx relies uponrelies upon yy,” express the,” express the
following in unambiguous English:following in unambiguous English:
∀∀xx((∃∃y Ry R((x,yx,y))=))=
∃∃yy((∀∀xx RR((x,yx,y))=))=
∃∃xx((∀∀y Ry R((x,yx,y))=))=
∀∀yy((∃∃x Rx R((x,yx,y))=))=
∀∀xx((∀∀y Ry R((x,yx,y))=))=
Everyone has someone to rely on.
There’s a poor overburdened soul whom
everyone relies upon (including himself)!
There’s some needy person who relies
upon everybody (including himself).
Everyone has someone who relies upon them.
Everyone relies upon everybody,
(including themselves)!
Topic #3 – Predicate Logic
62. 03/07/17 62
Module #1 - Logic
Nested quantifiers
AssumeAssume S(x,y)S(x,y) means “means “xx seessees yy””
u.d.=all peopleu.d.=all people
What does the following formula mean?What does the following formula mean?
∀∀xSxS((x,ax,a))
63. 03/07/17 63
Module #1 - Logic
Nested quantifiers
AssumeAssume S(x,y)S(x,y) means “means “xx seessees yy”.”.
u.d.=all peopleu.d.=all people
∀∀xSxS((x,ax,a) means) means
“For every“For every xx,, xx seessees aa””
In other words,In other words,
“Everyone sees“Everyone sees aa””
64. 03/07/17 64
Module #1 - Logic
Nested quantifiers
What does the following formula mean?What does the following formula mean?
∀∀xx((∃∃y Sy S((x,yx,y))))
65. 03/07/17 65
Module #1 - Logic
Nested quantifiers
∀∀xx((∃∃y Sy S((x,yx,y)) means “)) means “For everyFor every xx, there exists, there exists
aa yy such thatsuch that xx seessees y”y”
In other words:In other words:
“Everyone sees someone”“Everyone sees someone”
66. 03/07/17 66
Module #1 - Logic
Interactions between
quantifiers and connectives
Let the u.d. beLet the u.d. be parking spaces at NSUparking spaces at NSU..
LetLet PP((xx) be “) be “xx is occupied.”is occupied.”
Let Q(Let Q(xx) be “) be “xx is free of charge.”is free of charge.”
1.1. ∃∃xx ((QQ((xx)) ∧∧ PP((xx))))
2.2. ∀∀xx ((QQ((xx)) ∧∧ PP((xx))))
3.3. ∀∀xx ((QQ((xx)) →→PP((xx))))
4.4. ∃∃xx ((QQ((xx)) →→ PP((xx))))
67. 03/07/17 67
Module #1 - Logic
I. Construct English paraphrases
Let the u.d. beLet the u.d. be parking spaces at NSUparking spaces at NSU..
LetLet PP((xx) be “) be “xx is occupied.”is occupied.”
Let Q(Let Q(xx) be “) be “xx is free of charge.”is free of charge.”
1.1. ∃∃xx ((QQ((xx)) ∧∧ PP((xx))))
2.2. ∀∀xx ((QQ((xx)) ∧∧ PP((xx))))
3.3. ∀∀xx ((QQ((xx)) →→PP((xx))))
4.4. ∃∃xx ((QQ((xx)) →→ PP((xx))))
68. 03/07/17 68
Module #1 - Logic
I. Construct English paraphrases
1.1. ∃∃xx ((QQ((xx)) ∧∧ PP((xx))) Some places are free of) Some places are free of
charge and occupiedcharge and occupied
2.2. ∀∀xx ((QQ((xx)) ∧∧ PP((xx))) All places are free of) All places are free of
charge and occupiedcharge and occupied
3.3. ∀∀xx ((QQ((xx)) →→PP((xx))) All places that are free) All places that are free
of charge are occupiedof charge are occupied
4.4. ∃∃xx ((QQ((xx)) →→ PP((xx))) For some places x, if x) For some places x, if x
is free of charge then x is occupiedis free of charge then x is occupied
69. 03/07/17 69
Module #1 - Logic
About the last of these
4.4. ∃∃xx ((QQ((xx)) →→ PP((xx))) “For some x, if x is free of) “For some x, if x is free of
charge then x is occupied”charge then x is occupied”
∃∃xx ((QQ((xx)) →→ PP((xx)))) is true iff, for some place a,is true iff, for some place a,
QQ((aa)) →→ PP((aa) is true.) is true.
QQ((aa)) →→ PP((aa)) is true iffis true iff
QQ((aa) is false) is false oror PP((aa) is true) is true
(conditional is only false in one row of table!)(conditional is only false in one row of table!)
So,So, the formula meansthe formula means “Some places are either“Some places are either
not free of charge or occupied”not free of charge or occupied”
70. 03/07/17 70
Module #1 - Logic
About the last of these
4.4. ∃∃xx ((QQ((xx)) →→ PP((xx)))) When confused by aWhen confused by a
conditional: re-write it usingconditional: re-write it using negationnegation andand
disjunctiondisjunction::
∃∃xx ((¬¬QQ((xx)) ∨∨ PP((xx)))) ⇔⇔ (p. 67)(p. 67)
∃∃xx ¬¬QQ((xx)) ∨∨ ∃∃x Px P((xx)) “Some places are“Some places are
not free of charge or some places arenot free of charge or some places are
occupied”occupied”
72. 03/07/17 72
Module #1 - Logic
Natural language is ambiguous!
• ““Everybody likes somebody.”Everybody likes somebody.”
– For everybody, there is somebody they like,For everybody, there is somebody they like,
∀∀∀xx ∃∃yy LikesLikes((xx,,yy))
– or, there is somebody (a popular person) whomor, there is somebody (a popular person) whom
everyone likes?everyone likes?
∀∃∃yy ∀∀xx LikesLikes((xx,,yy))
• ““Somebody likes everybody.”Somebody likes everybody.”
– Same problem: Depends on context, emphasis.Same problem: Depends on context, emphasis.
[Probably more likely.]
Topic #3 – Predicate Logic
73. 03/07/17 73
Module #1 - Logic
End of §1.3-1.4, Predicate Logic
• From these sections you should have learned:From these sections you should have learned:
– Predicate logic notation & conventionsPredicate logic notation & conventions
– Conversions: predicate logicConversions: predicate logic ↔↔ clear Englishclear English
– Meaning of quantifiers, equivalencesMeaning of quantifiers, equivalences
– Simple reasoning with quantifiersSimple reasoning with quantifiers
• Upcoming topics:Upcoming topics:
– Introduction to proof-writing.Introduction to proof-writing.
– Then: Set theory –Then: Set theory –
• a language for talking about collections of objects.a language for talking about collections of objects.
Topic #3 – Predicate Logic
Editor's Notes
We normally attribute propositional logic to George Boole, who first formalized it. Actually the particular formal notation we will present is not precisely Boole’s; he originally spoke of logic in terms of sets, not propositions, and he also used Boolean algebra notation such as AB, A+B, rather than the A /\ B, A \/ B notation we will use. But, he was the first to mathematically formalize these kinds of concepts in preserved writings. Boole’s formalization of logic was developed further by the philosopher Frege.
However, even though logic was not formalized as such until the 1800’s, the basic ideas of it go all the way back to the ancient Greeks. Aristotle (ca. 384-322 B.C.) developed a detailed system of logic (though one that was not quite as convenient and powerful as the modern one), and Chrysippus of Soli (ca. 281-205 B.C.) introduced a logic centered around logic AND, inclusive and exclusive OR, NOT, and implication, similarly to Boole’s. Chrysippus’ logic apparently included all of the key rules that Boole’s logic had. However, his original works were unfortunately lost; we only have fragments quoted by other authors.
Later in the course, we will see that operators can themselves be defined in terms of functions. This slide doesn’t define them that way because we haven’t defined functions yet. But for your reference, when you come back to study this section after learning about functions, in general, an n-ary operator O on any set S (the domain of the operator) is a function O:S^n->S mapping n-tuples of members of S (the operands) to members of S. “S^n” here denotes S with n as a superscript, that is, the nth Cartesian power of S. All this will be defined later when we talk about set theory.
For Boolean operators, the set we are dealing with is B={True,False}.
A unary Boolean operator U is a function U:B->B, while a binary Boolean operator T is a function T:(B,B)->B.
Binary operators are conventionally written in between their operands, while unary operators are usually written in front of their operands. (One exception is the post-increment and post-decrement operators in C/C++/Java, which are written after their operands.)
OR is also commutative and associative.
The animated picture on the right is just a memory device to help you remember that the disjunction operator is symbolized with a downward-pointing wedge, like the blade of an axe, because it “splits” a proposition into two parts, such that you can take either part (or both), if you are trying to decide how to make the whole proposition true.
Note that the meaning of disjunction is like the phrase “and/or” which is sometimes used in informal English. “The car has a bad engine and/or a bad carburetor.”
As an exercise, drop the truth tables for f /\ (g \/ s) and (f /\ g) \/ s to see that they’re different, and thus the parentheses are necessary.
Precedence conventions such as the one in the second bullet help to reduce the number of parentheses needed in expressions. Note that negation, with its tight binding (high precedence), and with its position to the left of its operand, behaves similarly to a negative sign in arithmetic.
There is also a precedence convention that you see sometimes (for example, in the C programming language) that AND takes precedence over OR. However, this convention is not quite universally accepted, not all systems adopt it. Therefore, to be safe, you should always include parentheses whenever you are mixing ANDs and ORs in a single sequence of binary operators.
For slides that have interactive exercises, it may be a good idea to stop the class for a minute to allow the students to discuss the problem with their neighbors, then call on someone to answer. This will help keep the students engaged in the lecture activity.
Note that the definition of “p implies q” says: “If p is true, then q is true, and if p is not true, then q is either true or false.” Well, saying that q is either true or false is not saying anything, since any proposition is, by the very definition of a proposition, either true or false. So, the last part of that sentence (covering the case where p is not true) is not really saying anything. So we may as well say the definition is, “If p is true, then q is true.”
Sometimes the antecedent is called the hypothesis and the consequent is called the conclusion.
Let’s consider the rows of the truth table, one at a time. In the first row, p is false and q is false. Now, let’s consider the definition of p->q. It says “If p is true, then q is true, but if p is false, then q is either true or false.” Well, in this case, p is false, and q is either true or false (namely false), so the second part of the statement is true. But, of course that part is true, since it is just a tautology that q is either true or false. In other words, and if is always true when its antecedent is false.
Similarly, the second row is True.
The third row is false, since p is true but q is false, so it is not the case that if p is true then q is true.
Finally, in the fourth row, since p is true and q is true, it is the case that if q is true then q is true.
Many students have trouble with the implication operator. When we say, “A implies B”, it is just a shorthand for “either not A, or B”. In other words, it is just the statement that it is NOT the case that A is true and B is false.
This often seems wrong to students, because when we say “A implies B” in everyday English, we mean that if somehow A were to become true in some way, somehow, the statement B would automatically be thereby made true, as a result. This does not seem to be the case in general when A and B are just two random false statements (such as the example in the last bullet). (However in this case, we might make a convoluted argument that the antecedent really DOES effectively imply the consequent: Note that if 1=0, then if a given pig flies 0 times in his life, then he also flies 1 time, thus he can fly.)
In any case, perhaps a more accurate and satisfying English rendering of the true meaning of the logical claim “A implies B”, might be just, “the possibility that A implies B is not contradicted directly by the truth values of A and B”. In other words, “it is not the case that A is true and B is false.” (Since that combination of truth values would directly contradict the hypothesis that A implies B.)
The first one is true because T->T is True. It doesn’t matter that my lecture ending is not the cause of the sun rising tomorrow.
The second one is false for me, because although Tuesday is a day of the week, I am most certainly NOT a penguin. (But, if a penguin were to say this statement, then it would be true for him.)
The third one is true, because 1+1 is not equal to 6. F->T is True.
The last one is true, because the moon is not made of green cheese. F->F is True.
Also, note that the converse and inverse of p->q also have the same meaning as each other.
Also, p IFF q is equivalent to (p -> q) /\ (q -> p). (“/\” being the AND wedge)
Bits can also be defined in terms of sets, if you like, by the convention that the empty set {} represents 0, and the set containing the empty set {{}} represents 1. Or more generally, any two distinct objects can represent the two bit-values or truth-values.
The answers are present, but hidden, as white text on a white background. The slide can be done in class as an exercise, with the instructor typing in the students’ answers in the space provided. Then the correct answers can be revealed by selecting the bottom 3 rows and changing their font color unconditionally to black.