1 CA 208 Logic Logic Prof. Josef van Genabith Textbooks:  The Essence of Logic, John Kelly, Prentice Hall, 1997  Prolog Programming, Third Edition, Ivan.

Slides:



Advertisements
Similar presentations
Artificial Intelligence
Advertisements

1 Knowledge Representation Introduction KR and Logic.
CS1502 Formal Methods in Computer Science Lecture Notes 3 Consequence Rules Boolean Connectives.
CSE 311: Foundations of Computing Fall 2013 Lecture 3: Logic and Boolean algebra.
Logic Use mathematical deduction to derive new knowledge.
Knowledge Representation Methods
CS128 – Discrete Mathematics for Computer Science
1 CA 208 Logic Ex1 In your own words, define the following 1. Logic: 2. Valid reasoning/inference (2 equivalent definitions): 3. Propositions/statements:
Artificial Intelligence Modal Logic
Syllabus Every Week: 2 Hourly Exams +Final - as noted on Syllabus
1 CA 208 Logic PQ PQPQPQPQPQPQPQPQ
1 Chapter 7 Propositional and Predicate Logic. 2 Chapter 7 Contents (1) l What is Logic? l Logical Operators l Translating between English and Logic l.
1 Math 306 Foundations of Mathematics I Math 306 Foundations of Mathematics I Goals of this class Introduction to important mathematical concepts Development.
Let remember from the previous lesson what is Knowledge representation
Proof by Deduction. Deductions and Formal Proofs A deduction is a sequence of logic statements, each of which is known or assumed to be true A formal.
CSE115/ENGR160 Discrete Mathematics 01/17/12 Ming-Hsuan Yang UC Merced 1.
Propositional Logic Review
Intro to Discrete Structures
Week 1 - Wednesday.  Course overview  Propositional logic  Truth tables  AND, OR, NOT  Logical equivalence.
Discrete Mathematics and Its Applications
1 Chapter 7 Propositional and Predicate Logic. 2 Chapter 7 Contents (1) l What is Logic? l Logical Operators l Translating between English and Logic l.
Chap. 2 Fundamentals of Logic. Proposition Proposition (or statement): an declarative sentence that is either true or false, but not both. e.g. –Margret.
Pattern-directed inference systems
1 CMSC 250 Discrete Structures CMSC 250 Lecture 1.
Reading: Chapter 4 (44-59) from the text book
CS 381 DISCRETE STRUCTURES Gongjun Yan Aug 25, November 2015Introduction & Propositional Logic 1.
Fundamentals of Logic 1. What is a valid argument or proof? 2. Study system of logic 3. In proving theorems or solving problems, creativity and insight.
LOGIC Lesson 2.1. What is an on-the-spot Quiz  This quiz is defined by me.  While I’m having my lectures, you have to be alert.  Because there are.
1 Introduction to Computational Linguistics Eleni Miltsakaki AUTH Spring 2006-Lecture 8.
Hazırlayan DISCRETE COMPUTATIONAL STRUCTURES Propositional Logic PROF. DR. YUSUF OYSAL.
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
1 CA 208 Logic PQ PQPQPQPQPQPQPQPQ
1 Introduction to Abstract Mathematics Expressions (Propositional formulas or forms) Instructor: Hayk Melikya
Artificial Intelligence “Introduction to Formal Logic” Jennifer J. Burg Department of Mathematics and Computer Science.
11 Artificial Intelligence CS 165A Thursday, October 25, 2007  Knowledge and reasoning (Ch 7) Propositional logic 1.
What is Reasoning  Logical reasoning is the process of drawing conclusions from premises using rules of inference.  These inference rules are results.
Week 1 - Wednesday.  Course overview  Propositional logic  Truth tables  AND, OR, NOT  Logical equivalence.
Chapter 2 Fundamentals of Logic 1. What is a valid argument or proof?
Chapter 7. Propositional and Predicate Logic Fall 2013 Comp3710 Artificial Intelligence Computing Science Thompson Rivers University.
Mathematics for Comter I Lecture 2: Logic (1) Basic definitions Logical operators Translating English sentences.
Propositional Logic Rather than jumping right into FOL, we begin with propositional logic A logic involves: §Language (with a syntax) §Semantics §Proof.
ARTIFICIAL INTELLIGENCE Lecture 2 Propositional Calculus.
Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and Quantifiers.
Lecture 10 Methods of Proof CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
1 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Lecture 01: Boolean Logic Sections 1.1 and 1.2 Jarek Rossignac.
Foundations of Discrete Mathematics Chapter 1 By Dr. Dalia M. Gil, Ph.D.
CT214 – Logical Foundations of Computing Darren Doherty Rm. 311 Dept. of Information Technology NUI Galway
Artificial Intelligence Knowledge Representation.
Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Fundamentals of Logic 1. What is a valid argument or proof? 2. Study system of logic 3. In proving theorems.
March 3, 2016Introduction to Artificial Intelligence Lecture 12: Knowledge Representation & Reasoning I 1 Back to “Serious” Topics… Knowledge Representation.
Artificial Intelligence Logical Agents Chapter 7.
Module Code MA0003NI: Computing mathematics Lecture for Week Autumn.
Chapter 7. Propositional and Predicate Logic
2. The Logic of Compound Statements Summary
CS 4700: Foundations of Artificial Intelligence
Lecture 1 – Formal Logic.
Knowledge Representation and Reasoning
Discrete Mathematics Logic.
Propositional Calculus: Boolean Algebra and Simplification
Information Technology Department
CS201: Data Structures and Discrete Mathematics I
Back to “Serious” Topics…
The Method of Deduction
Chapter 7. Propositional and Predicate Logic
CSNB234 ARTIFICIAL INTELLIGENCE
COMP 1380 Discrete Structures I Thompson Rivers University
Logic Logic is a discipline that studies the principles and methods used to construct valid arguments. An argument is a related sequence of statements.
CS201: Data Structures and Discrete Mathematics I
Introduction to Computational Linguistics
The Foundations: Logic and Proofs
Presentation transcript:

1 CA 208 Logic Logic Prof. Josef van Genabith Textbooks:  The Essence of Logic, John Kelly, Prentice Hall, 1997  Prolog Programming, Third Edition, Ivan Bratko, Addision-Wesley, 2001 Lecture Wednesday Tutorials/Labs Friday

2 CA 208 Logic Course Structure Propositional Logic First-Order Predicate Logic Prolog (Programming in Logic) Assessment 50% Continuous assessment (~ week 8) 50% Final Exam

3 CA 208 Logic Why Logic? What is Logic used for? Computers (Hardware/chips/CPUs etc.) are made of Logic (nand/nor gates etc.) You can program in Logic: Prolog (one of the main programming paradigms:  Procedural/imperative: Basic, Fortran, Pascal, C,...  Object oriented: C++, Java,...  Logic: Prolog  Functional: Lisp, Miranda, Haskell,... Artificial Intelligence AI  Intelligence = learn and reason (Machine learning and logic) Deep connection between abstract models of computation and logic/proofs: Curry-Howard correspondence Logic is foundation of maths People use logic... …

4 CA 208 Logic Logic Today: Intuitions... Jargon... If you get these right, Logic is easy!!! Formalisation comes after intuitions...! Not so well covered in the text books

5 CA 208 Logic What is logic? Logic is the science of reasoning / inferencing / drawing conclusions We do this all the time... What is involved in reasoning? Premises and Conclusions Premises: what you hold to be true Conclusions: what you derive from the premises

6 CA 208 Logic An example: P: If John goes to the party then Mary goes to the party. John goes to the party. C: Mary goes to the party. We say that “P entails C”, “C logically follows from P”, “C is derived from P”, “C is inferred from P”, etc. We write “P |= C” or “P|- C” ((double) turnstile)

7 CA 208 Logic An example: P: If John goes to the party then Mary goes to the party. John goes to the party. C: Mary goes to the party. There are many types of Logic... Classical Logic, intuitionistic logic, linear logic, non- monotonic logic, defeasible logic, fuzzy logic,... There is a whole zoo of logics!

8 CA 208 Logic An example: P: If John goes to the party then Mary goes to the party. John goes to the party. C: Mary goes to the party. There are many types of Logic... In this course we look at classical Logic(s) only ! (In AI, KR you may come across some of the other logics).

9 CA 208 Logic An example: P: If John goes to the party then Mary goes to the party. John goes to the party. C: Mary goes to the party. What is classical Logic? Classical Logic studies/characterises/defines valid reasoning Valid reasoning is a very strict type of reasoning where truth of the premises guarantees truth of the conclusions (if you use the rules of classical logic to do the reasoning, i.e. to derive the conclusion!)

10 CA 208 Logic An example: P: If John goes to the party then Mary goes to the party. John goes to the party. C: Mary goes to the party. Our example is a valid inference! Why? Well, if the premisses are true, then the conclusion is true In other words: it cannot be the case that all the premisses are true and the conclusion is false

11 CA 208 Logic An example: P: If John goes to the party then Mary goes to the party. John goes to the party. C: Mary goes to the party. Our example is a valid inference! Why? In all the situations where the premisses are true, the conclusion is true as well In other words: it cannot be the case that there is a situation where all the premisses are true and the conclusion is false

12 CA 208 Logic Another example: P: If John goes to the party then Mary goes to the party. Mary goes to the party. C: John goes to the party. Is this a valid inference? I.e. does truth of premisses guarantee truth of conclusion? Can you come up with a situation where P is true and C is false? ?

13 CA 208 Logic Another example: P: If John goes to the party then Mary goes to the party. Mary goes to the party. C: John goes to the party. Is this a valid inference? I.e. does truth of premisses guarantee truth of conclusion? Can you come up with a situation where P is true and C is false? Yes... !!!!

14 CA 208 Logic Formalisation: P: If John goes to the party then Mary goes to the party. John goes to the party. C: Mary goes to the party. Logicians (like mathematicians, computer scientists/programmers, engineers) are lazy... They don’t like to write very much... They like abstraction and generalisation... They don’t like specific cases... So how do they/can we generalise this logic stuff?? We express that reasoning stuff as formulas ;-)

15 CA 208 Logic Formalisation: P: If John goes to the party then Mary goes to the party. John goes to the party. C: Mary goes to the party. Premisses and conclusions are made up of complex and elementary “propositions” or ”statements” What are propositions/statements? Sentences that are true or false

16 CA 208 Logic Formalisation: P: If John goes to the party then Mary goes to the party. John goes to the party. C: Mary goes to the party.

17 CA 208 Logic Formalisation: P: If John goes to the party then Mary goes to the party. John goes to the party. C: Mary goes to the party.

18 CA 208 Logic Formalisation: P: If John goes to the party then Mary goes to the party. John goes to the party. C: Mary goes to the party.

19 CA 208 Logic Formalisation: P: If John goes to the party then Mary goes to the party. John goes to the party. C: Mary goes to the party.

20 CA 208 Logic Formalisation: P: If John goes to the party then Mary goes to the party. John goes to the party. C: Mary goes to the party.

21 CA 208 Logic Formalisation: P: If John goes to the party then Mary goes to the party. John goes to the party. C: Mary goes to the party. How: look at the components of the premisses and conclusion Special symbols (if __ then __ ) Component propositions/statements: John goes to the party = A Mary goes to the party = B

22 CA 208 Logic Formalisation: P: If John goes to the party then Mary goes to the party. John goes to the party. C: Mary goes to the party. P: {If A then B, A} C: B A = John goes to the party B = Mary goes to the party

23 CA 208 Logic Formalisation: P: If John goes to the party then Mary goes to the party. John goes to the party. C: Mary goes to the party. P: {If A then B, A} P |= C C: B {If A then B, A} |= B A = John goes to the party B = Mary goes to the party

24 CA 208 Logic And now sth. absolutely amazing happens: P: {If A then B, A} C: B A = John goes to the party, B = Mary goes to the party A = Kate is a CA2 student, B = Kate does Logic P: If Kate is a CA2 student, then Kate does Logic. Kate is a CA2 student. C: Kate does Logic. Is that a valid inference?

25 CA 208 Logic And now sth. absolutely amazing happens: P: {If A then B, A} C: B A = John goes to the party, B = Mary goes to the party A = Kate is a CA2 student, B = Kate does Logic P: If Kate is a CA2 student, then Kate does Logic. Kate is a CA2 student. C: Kate does Logic. Is that a valid inference? YES!!!!

26 CA 208 Logic And now sth. amazing happens: P: {If A then B, A} C: B A = John goes to the party, B = Mary goes to the party A = Kate is a CA2 student, B = Kate does Logic You get another valid inference! In fact you get loads of valid inferences from the abstract {If A then B, A} |- B schema above by replacing the propositional variables with actual propositions... The old Greeks copped on to that some 2500 years ago... Aristotle, rules/mathematics of inference, syllogisms,..., rules that guarantee that if you apply them to true premises you get true conclusions !!! (Aside the Greeks didn’t get all of them right)

27 CA 208 Logic And now another amazing thing happens: Logic is not just about the “real” world! You can consider premises that are not true in real world: P: {If A then B, A} C: B A = Kate is a CA2 student, B = Kate does Formal Languages P: If Kate is a CA2 student, then Kate does Formal Languages. Kate is a CA2 student. C: Kate does Formal Languages. P |- C, i.e. this is a vaild inference but: but C not true in “real” world. Kate could be CAIS student! So Logic allows us to explore hypothetical scenarios: for the sake of the inference, imagine situations where all of the premises in P are true...

28 CA 208 Logic Another example... P: John likes soccer and John likes Kate. C: John likes Kate. Is that vaild? Formalise: P: { A and B } P |- C C: B { A and B } |- B Another one... A = Kate is a student, B = Kate likes the bar What about { A and B } |- A ? Is that valid?

29 CA 208 Logic Another example... P: John likes soccer. John likes Kate. C: John likes soccer and John likes Kate. Formalise: P: { A, B } C: A and B P |- C { A, B } |- A and B A = Kate is a student, B = Kate likes the bar What about { A, B } |- B and A ? Is that valid?

30 CA 208 Logic What are propositions/statements? Statements/Propositions are sentences that are either true or false!  John likes soccer.  Kate is a CA student. Not all sentences are propositions/statements: Questions/Interrogatives:  Is Kate a CA student? Commands/Imperatives:  Give John a copy of the exam! Classical logic is only about statements/propositions!!! The only thing you can have in the premises and conclusions are statements and special connection words (like if _ then _, and..)

31 CA 208 Logic What are the special connection words? _ and _ (A and B) _ or _ (A or B) if _ then _ (if A then B) _ if and only if _ (A iff B) not _ (not A)

32 CA 208 Logic You have seen this before: Logicians are lazy... A and B A  B A or B A  B if A then B A  B (P implies Q) A iff B A  B not A  A Note that different books may use different symbols, e.g. & for ,  for  and the like... That is just to confuse you...

33 CA 208 Logic So with this we can write {A  B, A} |- B {A  B } |- A {A  B } |- B {A, B} |- A  B And the like...

34 CA 208 Logic What is the “meaning” of the logical connectives      ? We’ll define the meaning of the connectives in two ways: Truth tables (Semantics, |= ) Proofs (Syntax, |- ) Meaning of the logical connectives is not exactly like the meaning of not, and, or, implies etc. in English (natural language)... We’ll see examples of that!

35 CA 208 Logic What’s a truth table? A truth table shows all possible situations in which the proposional arguments of a logical connective are true or false and defines the truth value of the complex proposition in terms of these. Intutively the complex proposition John likes football and Mary likes the bar is true in all situations where ‘John likes football’ is true and where ‘Mary likes the bar’ is true, and false in all other situations. P  Q is true in all situations where P is true and where Q is true, and false in all other situations. There can be infinitely many situations in which P, Q are true – we don’t want to look at all of them...! Truth tables cluster them together and capture what is essential about them.

36 CA 208 Logic We capture this in a truth table. We write ‘1’ for true and ‘0’ for false (or T, F) Truth table for  PQ PQPQ

37 CA 208 Logic We capture this in a truth table. We write ‘1’ for true and ‘0’ for false (or T, F) Truth table for  PQ PQPQ

38 CA 208 Logic Question: Is P  Q = Q  P ? Logical equivalence, same meaning Use truth table... PQ PQPQQPQP

39 CA 208 Logic Question: Is P  Q = Q  P ? Logical equivalence, same meaning Use truth table... Hence P  Q = Q  P We say that P  Q and Q  P are logically equivalent, i.e. They have the same truth value (i.e. meaning) under each interpretation (situation) We write (P  Q)  (Q  P) Temporal aspect of natural language ‘and’... PQ PQPQQPQP

40 CA 208 Logic PQ PQPQ PQ PQPQQPQP Sometimes exclusive aspect of meaning of natural language ‘or’... Logical or is inclusive...

41 CA 208 Logic PQ PQPQ PQ P  QQ  P Natural language implication has often element of causality... Logical implication doesn’t... !!!!

42 CA 208 Logic PQ PQPQ

43 CA 208 Logic PQ PQPQPQPQPQPQPQPQ

44 CA 208 Logic PQ PQPQPQPQPQPQPQPQ

45 CA 208 Logic PQ PQPQPQPQPQPQPQPQ

46 CA 208 Logic PQ PQPQPQPQPQPQPQPQ

47 CA 208 Logic PQ PQPQPQPQPQPQPQPQ

48 CA 208 Logic P PP P PP   P

49 CA 208 Logic PQ PQPQPQPQPQPQPQPQ

50 CA 208 Logic A (Boolean) algebra of Logic Commutativity Associativity Distributivity Idempotency Absorption... PQ PQPQPQPQPQPQPQPQ