Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Copyright © 2006-2014 - Curt Hill Using Propositional Logic Several applications."— Presentation transcript:

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

2 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

3 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

4 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

5 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

6 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

7 Assertions The given assertions are: –¬b –¬m –b  m  h  c –a–a The chauffeur at the airport implies that he could not murder the heiress –a  ¬h–a  ¬h Copyright © 2006-2014 - Curt Hill

8 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

9 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

10 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

11 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

12 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

13 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

14 Table A says the two of us are knights B says A is a knave Copyright © 2006-2014 - Curt Hill A Two of us are knights B A is a knave TT TF FT FF

15 Table Filled In Copyright © 2006-2014 - Curt Hill A The two of us are knights B A is a knave TTF TFF FTT FFF

16 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 slides Copyright © 2006-2014 - Curt Hill

17 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

18 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 

19 Copyright © 2005-2007 Curt Hill Half Adder A B Sum Carry   AND XOR

20 Copyright © 2005-2007 Curt Hill Full Adder Picture A In B In Carry In Half Adder Sum Carry Sum Out Carry Out Sum Carry

21 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

22 Copyright © 2005-2007 Curt Hill A Four Bit Adder Carry in A B Sum out A B A B A B Carry out

23 Exercises 1.2 5, 13, 17, 21, 35, 41 Copyright © 2006-2014 - Curt Hill


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

Similar presentations


Ads by Google