+ All Categories
Home > Documents > Copyright © 2006-2014 - Curt Hill Using Propositional Logic Several applications.

Copyright © 2006-2014 - Curt Hill Using Propositional Logic Several applications.

Date post: 29-Dec-2015
Category:
Upload: alberta-newman
View: 220 times
Download: 2 times
Share this document with a friend
23
Copyright © 2006-2014 - Curt Hill Using Propositional Logic Several applications
Transcript
Page 1: Copyright © 2006-2014 - Curt Hill Using Propositional Logic Several applications.

Copyright © 2006-2014 - Curt Hill

Using Propositional Logic

Several applications

Page 2: Copyright © 2006-2014 - Curt Hill Using Propositional Logic Several applications.

Introduction• Section 1.2 of the text considers

several topics relevant to propositional logic– Translation of English to logical

propositions– Systems Specifications– Web searches– Logic puzzles– Digital Logic Circuits

• Some of these will be covered here

Copyright © 2006-2014 - Curt Hill

Page 3: Copyright © 2006-2014 - Curt Hill Using Propositional Logic Several applications.

Translation

• It is often needed to take English language statements and create propositions or compound propositions from them

• However there are issues• Most natural languages are

ambiguous, while mathematical notation should not be

Copyright © 2014 Curt Hill

Page 4: Copyright © 2006-2014 - Curt Hill Using Propositional Logic Several applications.

Process

• Look for any statements that could have a true or false value– The more the better– Generate a key of letters and their

statements

• Look for the connectives– The main are negation, conjunction,

disjunction and conditional

• Put the final statement together

Copyright © 2006-2014 - Curt Hill

Page 5: Copyright © 2006-2014 - Curt Hill Using Propositional Logic Several applications.

Example• Consider the following text:

Neither the butler nor the maid did it. That leaves the chauffeur the cook. The chauffeur was at the airport at the time of the murder. The cook is the only one without an alibi. The heiress was murdered by poison. It is logical to conclude the cook did it.

• Now lets find the propositions

Copyright © 2006-2014 - Curt Hill

Page 6: Copyright © 2006-2014 - Curt Hill Using Propositional Logic Several applications.

Propositions

• Butler murdered heiress, b• Maid murdered heiress, m• Chauffeur murdered heiress, h• Cook murdered heiress, c• Chauffeur was at airport, a• Cook would have opportunity to

poison someone, p

Copyright © 2006-2014 - Curt Hill

Page 7: Copyright © 2006-2014 - Curt Hill Using Propositional Logic Several applications.

Assertions

• The given assertions are:– ¬b– ¬m– b m h c– a

• The chauffeur at the airport implies that he could not murder the heiress– a ¬h

Copyright © 2006-2014 - Curt Hill

Page 8: Copyright © 2006-2014 - Curt Hill Using Propositional Logic Several applications.

Result

• The implied assertion is the starting point: b m h c• The assertion states that one or more

of these must be true

• We know that b,m,h are false• Thus c must be true• That p is true only strengthens the

result

Copyright © 2006-2014 - Curt Hill

Page 9: Copyright © 2006-2014 - Curt Hill Using Propositional Logic Several applications.

Specifications• Their has been considerable interest in

formal specifications for programs and systems of programs– The idea is that English is too ambiguous– We specify the state of a program at the

beginning and end– Properly done it is not ambiguous– Not completely caught on due to the need

for personnel training

• Proving program correctness uses similar approach

• You may see this again

Copyright © 2006-2014 - Curt Hill

Page 10: Copyright © 2006-2014 - Curt Hill Using Propositional Logic Several applications.

Searches• Google has become a dominant

player due to its web searching capabilities

• The general notion of a search is that you are looking for a web page that contains certain terms connected by logical connectives

• Since the great quantity of pages, we need to be able to restrict our search more than enlarge it

Copyright © 2006-2014 - Curt Hill

Page 11: Copyright © 2006-2014 - Curt Hill Using Propositional Logic Several applications.

Logic Puzzles• There are a variety of puzzles that

force to use logic to solve• The book is partial to Knights and

Knaves• You are on an island with only two

types of inhabitants– Knights always tell the truth– Knaves always lie

• You meet two or three of them and from what they say determine which kind they are

Copyright © 2006-2014 - Curt Hill

Page 12: Copyright © 2006-2014 - Curt Hill Using Propositional Logic Several applications.

Example

• You meet two people A and B• A says the two of us are knights• B says A is a knave• What is the truth of the matter?

Copyright © 2006-2014 - Curt Hill

Page 13: Copyright © 2006-2014 - Curt Hill Using Propositional Logic Several applications.

Solving these

• Let A and B be variables– True means the person is a knight

and the negation the person is knave

• Then we set up a truth table and see which, if any, is consistent

• We may also reason about this without a truth table

Copyright © 2006-2014 - Curt Hill

Page 14: Copyright © 2006-2014 - Curt Hill Using Propositional Logic Several applications.

Table

• A says the two of us are knights• B says A is a knave

Copyright © 2006-2014 - Curt Hill

ATwo of us are knights

BA is a knave

T T

T F

F T

F F

Page 15: Copyright © 2006-2014 - Curt Hill Using Propositional Logic Several applications.

Table Filled In

Copyright © 2006-2014 - Curt Hill

AThe two of us are knights

BA is a knave

T T F

T F F

F T T

F F F

Page 16: Copyright © 2006-2014 - Curt Hill Using Propositional Logic Several applications.

Digital Logic Circuits

• This is the age of digital logic• All of our computers and computer

controlled devices implement Boolean logic

• A full coverage of this needs to await CSci 370 but here is just a teaser

• How would we add two binary numbers using gates?

• Consider the next six slidesCopyright © 2006-2014 - Curt Hill

Page 17: Copyright © 2006-2014 - Curt Hill Using Propositional Logic Several applications.

Copyright 2005 Curt Hill

Gates• At the lowest level the building blocks of

computers are gates or switches• A CPU is a collection of gates• The fact that we can implement these in

a rather straightforward matter makes the construction of computers possible

• Typical gates can be constructed with just a transistor or few diodes

• From there we will see that things like an adder can be constructed from gates

Page 18: Copyright © 2006-2014 - Curt Hill Using Propositional Logic Several applications.

Copyright 2005 Curt Hill

Gate Symbols

• We use a variety of symbols to diagram gate networks

• NOT• AND• OR• NAND (Not And)• NOR (Not Or)• Among others

Page 19: Copyright © 2006-2014 - Curt Hill Using Propositional Logic Several applications.

Copyright © 2005-2007 Curt Hill

Half Adder

A

B Sum

Carry

AND

XOR

Page 20: Copyright © 2006-2014 - Curt Hill Using Propositional Logic Several applications.

Copyright © 2005-2007 Curt Hill

Full Adder Picture

A In

B In

CarryIn

Half Adder

Half AdderSum

Carry

Sum Out

CarryOut

Sum

Carry

Page 21: Copyright © 2006-2014 - Curt Hill Using Propositional Logic Several applications.

Copyright © 2005-2007 Curt Hill

Notes on Full Adder

• The previous diagram showed a one bit full adder

• N of these will be cascaded into an N bit adder

• The adds will be done in parallel• The carrys will cause the main

delays– As the carry propagates down the line

Page 22: Copyright © 2006-2014 - Curt Hill Using Propositional Logic Several applications.

Copyright © 2005-2007 Curt Hill

A Four Bit Adder

Carryin

A

BSumout

A

BSumout

A

BSumout

A

BSumout

Carryout

Page 23: Copyright © 2006-2014 - Curt Hill Using Propositional Logic Several applications.

Exercises

• 1.2• 5, 13, 17, 21, 35, 41

Copyright © 2006-2014 - Curt Hill


Recommended