11 Artificial Intelligence CS 165A Thursday, October 25, 2007  Knowledge and reasoning (Ch 7) Propositional logic 1.

Slides:



Advertisements
Similar presentations
Artificial Intelligence
Advertisements

Some Prolog Prolog is a logic programming language
Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)
1 Logic Logic in general is a subfield of philosophy and its development is credited to ancient Greeks. Symbolic or mathematical logic is used in AI. In.
Logic Use mathematical deduction to derive new knowledge.
Agents That Reason Logically Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 7 Spring 2004.
Propositional Logic CMSC 471 Chapter , 7.7 and Chuck Dyer
Propositional Logic Reading: C , C Logic: Outline Propositional Logic Inference in Propositional Logic First-order logic.
Deduction In addition to being able to represent facts, or real- world statements, as formulas, we want to be able to manipulate facts, e.g., derive new.
Logic CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Logic.
Logic Concepts Lecture Module 11.
Knowledge Representation Methods
Knowledge Representation I Suppose I tell you the following... The Duck-Bill Platypus and the Echidna are the only two mammals that lay eggs. Only birds.
Logic in general Logics are formal languages for representing information such that conclusions can be drawn Syntax defines the sentences in the language.
Logical Agents Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 7 Fall 2005.
CS 561, Sessions Knowledge and reasoning – second part Knowledge representation Logic and representation Propositional (Boolean) logic Normal forms.
CS 460, Sessions Knowledge and reasoning – second part Knowledge representation Logic and representation Propositional (Boolean) logic Normal forms.
CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Lecture 9 Jim Martin.
Syllabus Every Week: 2 Hourly Exams +Final - as noted on Syllabus
Logical Agents Chapter 7. Why Do We Need Logic? Problem-solving agents were very inflexible: hard code every possible state. Search is almost always exponential.
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.
Knowledge Representation & Reasoning (Part 1) Propositional Logic chapter 6 Dr Souham Meshoul CAP492.
Logical Agents Chapter 7. Why Do We Need Logic? Problem-solving agents were very inflexible: hard code every possible state. Search is almost always exponential.
Knowledge Representation I (Propositional Logic) CSE 473.
Knoweldge Representation & Reasoning
Knowledge Representation & Reasoning (Part 1) Propositional Logic chapter 5 Dr Souham Meshoul CAP492.
Let remember from the previous lesson what is Knowledge representation
Logical Agents Chapter 7 Feb 26, Knowledge and Reasoning Knowledge of action outcome enables problem solving –a reflex agent can only find way from.
Logical Agents Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 7 Spring 2005.
Rutgers CS440, Fall 2003 Propositional Logic Reading: Ch. 7, AIMA 2 nd Ed. (skip )
Logical and Rule-Based Reasoning Part I. Logical Models and Reasoning Big Question: Do people think logically?
Propositional Logic Reasoning correctly computationally Chapter 7 or 8.
Inference is a process of building a proof of a sentence, or put it differently inference is an implementation of the entailment relation between sentences.
February 20, 2006AI: Chapter 7: Logical Agents1 Artificial Intelligence Chapter 7: Logical Agents Michael Scherger Department of Computer Science Kent.
Pattern-directed inference systems
Logical Agents Logic Propositional Logic Summary
1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of.
1 CMSC 471 Fall 2002 Class #10/12–Wednesday, October 2 / Wednesday, October 9.
Slide 1 Propositional Definite Clause Logic: Syntax, Semantics and Bottom-up Proofs Jim Little UBC CS 322 – CSP October 20, 2014.
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
Logical Agents Chapter 7. Knowledge bases Knowledge base (KB): set of sentences in a formal language Inference: deriving new sentences from the KB. E.g.:
Logical Agents Chapter 7. Outline Knowledge-based agents Logic in general Propositional (Boolean) logic Equivalence, validity, satisfiability.
CS6133 Software Specification and Verification
Artificial Intelligence “Introduction to Formal Logic” Jennifer J. Burg Department of Mathematics and Computer Science.
11 Artificial Intelligence CS 165A Tuesday, October 30, 2007  Knowledge and reasoning (Ch 7) Propositional logic  First-order logic (Ch 8) 1.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
Chapter 7. Propositional and Predicate Logic Fall 2013 Comp3710 Artificial Intelligence Computing Science Thompson Rivers University.
1 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts.
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.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
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.
Logical Agents. Inference : Example 1 How many variables? 3 variables A,B,C How many models? 2 3 = 8 models.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
Chapter 7. Propositional and Predicate Logic
CS 4700: Foundations of Artificial Intelligence
Knowledge Representation and Reasoning
Knowledge and reasoning – second part
Artificial Intelligence
Artificial Intelligence: Logic agents
CS 416 Artificial Intelligence
Knowledge and reasoning – second part
Back to “Serious” Topics…
Logical Agents Chapter 7.
Chapter 7. Propositional and Predicate Logic
Knowledge Representation I (Propositional Logic)
Propositional Logic CMSC 471 Chapter , 7.7 and Chuck Dyer
Logical and Rule-Based Reasoning Part I
Presentation transcript:

11 Artificial Intelligence CS 165A Thursday, October 25, 2007  Knowledge and reasoning (Ch 7) Propositional logic 1

2 Who is this key historical AI figure? Built a calculating machine that could add and subtract (which Pascal’s couldn’t) But his dream was much grander – to reduce human reasoning to a kind of calculation and to ultimately build a machine capable of carrying out such calculations Co-inventor of the calculus “For it is unworthy of excellent men to lose hours like slaves in the labor of calculation which could safely be relegated to anyone else if the machine were used.” Gottfried Leibniz ( )

33 Notes HW#2 posted, due Tuesday –5x5 Tic Tac Toe game –Can work in teams of two, but different partner than in HW#1 –Can use your (or your team’s) code from HW#1 as starting point –You’ll need to use a heuristic to evaluate positions and go down N ply in your search so that the program returns an answer in a “short” amount of time  About 10 seconds maximum.... ___________ |X|O|X|X|X| | |O|O|X| | | | |O|X| | | | | |O| | | | | | |O| ¯¯¯¯¯¯¯¯¯¯¯ 3 in a row : 1 point 4 in a row : 3 points 5 in a row : 5 points X : 2 points O : 3 points

4 Knowledge Base Inference engine Domain specific content; facts ASK TELL Domain independent algorithms; can deduce new facts from the KB KB Agents True sentences

5 Thursday Quiz 1.If KB is the knowledge base and  is a logical sentence, what is the meaning of this statement? KB  2.Propositions P and Q are both true. Is this sentence true or false:  P   Q Briefly explain.

6 Syntax and semantics example The PQ system – Syntax –A correct sentence must have the form  {0 or more dashes} p {0 or more dashes} q {0 or more dashes} –For example --p---q p-q- pq --p-q- --p---q---- -p-q-- p-q --pq-- --p---q--p-- -q-p-- -p-- --p-p-q---- The PQ system – Semantics –# plus # equals # –Which of the above sentence are TRUE? Not allowable LEGAL sentences and TRUE sentences are not the same thing!

7 Semantics Representation (abstraction) World Sentences Facts Semantics Note: Facts may or may not be true If sentence P is false, then sentence  P is true --p---q pq- --p--q = = = 5

8 Inference and Entailment Given a set of (true) sentences, logical inference generates new sentences –Sentence  follows from sentences {  i } –Sentences {  i } entail sentence  –The classic example is modus ponens: P  Q and P entail what? An inference procedure i can derive  from KB KB i  KB  A knowledge base (KB) entails sentences 

9 Inference and Entailment (cont.) Representation World Fact F OLLOWS E NTAILS Facts Sentences Semantics Sentence Semantics

10 Using propositional logic: rules of inference Inference (n.): a. The act or process of deriving logical conclusions from premises known or assumed to be true. b. The act of reasoning from factual knowledge or evidence. Inference rules capture patterns of sound inference –Once established, we don’t need to show the truth table every time Examples of inference rules: –((P  H)   H) P  I.e., if ((P  H)   H) is in the KB, then we can conclude P –((P  Q)  P) Q  I.e., if ((P  Q)  P) is in the KB, then we can conclude Q

11 Inference engine An inference engine is a program that applies inference rules to knowledge –Goal: To infer new (and useful) knowledge Separation of –Knowledge –Rules –Control Which rules should we apply when? Inference engine

12 Inference procedures An inference procedure –Generates new sentences  that purport to be entailed by the knowledge base …or... –Reports whether or not a sentence  is entailed by the knowledge base Not every inference procedure can derive all sentences that are entailed by the KB A sound or truth-preserving inference procedure generates only entailed sentences Inference derives valid conclusions independent of the semantics (i.e., independent of the interpretation)

13 Inference procedures (cont.) Soundness of an inference procedure –i is sound if whenever KB i , it is also true that KB  –I.e., the procedure only generates entailed sentences Completeness of an inference procedure –i is complete if whenever KB , it is also true that KB i  –I.e., the procedure can find a proof for any sentence that is entailed The derivation of a sentence by a sound inference procedure is called a proof –Hence, the proof theory of a logical language specifies the reasoning steps that are sound

14 Logics We will soon define a logic which is expressive enough to say most things of interest, and for which there exists a sound and complete inference procedure –I.e., the procedure will be able to derive anything that is derivable from the KB –This is first-order logic, a.k.a. first-order predicate calculus –But first, we need to define propositional logic

15 Propositional (Boolean) Logic Symbols represent propositions (statements of fact, sentences) –P means “San Francisco is the capital of California” –Q means “It is raining in Seattle” Sentences are generated by combining proposition symbols with Boolean (logical) connectives

16 Propositional Logic Syntax –True, false, propositional symbols –( ),  (not),  (and),  (or),  (implies),  (equivalent) Examples of sentences in propositional logic P 1, P 2, etc. (propositions) ( S 1 )  S 1 S 1  S 2 S 1  S 2 S 1  S 2 S 1  S 2 true P 1  true   ( P 2  false ) P  Q  Q  P

17 Propositional (Boolean) Logic (cont.) Semantics –Defined by clearly interpreted symbols and straightforward application of truth tables –Rules for evaluating truth: Boolean algebra –Simple method: truth tables 2 N rows for N propositions

18 Propositional (Boolean) Logic (cont.) Make sure you know simple Boolean logic Associative, commutative, and distributive laws P  Q  Q  P (P  Q)  R  P  (Q  R) P  (Q  R)  (P  Q)  (P  R)  P  P  (P  Q)   P   Q  (P  Q)   P   Q P  Q   P  Q DeMorgan’s Laws Important!

19 Basic logical equivalences Equivalent Sentences  P  QP  QP  Q P True  P P  QP  QTrue  P  Q P  False P PPP  False

20 Satisfiability and Validity Is this true: ( P  Q ) ? –It depends on the values of P and Q –This is a satisfiable sentence – there are some interpretations for which it is true –In other words, it depends: it could be true or false Is this true: ( P   P ) ? –No, it is never true –This is an unsatisfiable sentence (self-contradictory) – there is no interpretation for which it is true Is this true: ( ((P  Q)   Q)  P ) ? –Yes, independent of the values of P and Q –This is a valid sentence – it is true under all possible interpretations (a.k.a. a tautology) –Truth tables can test for validity

21 Propositional logic (cont.) A  C –The premise implies the conclusion... or...  The antecedent implies the consequent –What if A  C is always true? Example: Then we can say that the antecedent entails the consequent. In other words, P and H can be seen as variables – this is true for any statements P and Q.

22 One can say that the premise entails the conclusion –((P  H)   H) entails P –((P  H)   H) P Have we also shown that ((P  H)   H) P ? Well, yes and no.... We still don’t have a method to derive this. But if we add this inference rule explicitly to our system, with P and H as variables representing any two propositions, then we do have such a procedure.

23 Using propositional logic: rules of inference Inference rules capture patterns of sound inference –Once established, don’t need to show the truth table every time –E.g., we can define an inference rule: ((P  H)   H) P for variables P and H  “If we know , then we can conclude  ” Alternate notation for inference rule   : (where  and  are propositional logic sentences)

24 Inference KB  1 KB,  1  2 KB,  1,  2  3 …  Inference steps KB   1,  2, …  or We’re particularly interested in So we need a mechanism to do this! Inference rules that can be applied to sentences in our KB

25 Important Inference Rules for Propositional Logic

26 Resolution Rule: one rule for all inferences Propositional calculus resolution or Remember: p  q   p  q, so let’s rewrite it as: Resolution is really the “chaining” of implications. Would like to show that resolution is sound and (essentially) complete (use Deduction Rule for proof)

27 Inference in Propositional Logic Three ways to answer: “Is Mary the grandparent of Ann?” –One way:  Find sentence P (“Mary is the grandparent of Ann”) in KB –Another way:  Put sentence  P in the KB, and use inference rules to prove a contradiction (false) –Yet another way:  Find sentence Q (“Mary is parent of Frank”), sentence R (“Frank is the parent of Ann”), and sentence Q  R  S, where S is the proposition “Mary is grandparent of Ann”  Then apply modus ponens: Q  R  S, Q  R to conclude S (“Mary is the grandparent of Ann”) “If Mary is the parent of Frank and Frank is the parent of Ann, then Mary is the grandparent of Ann”