1 / 27

Artificial Intelligence

Learn about Gottfried Leibniz, a key historical figure in AI, who built a calculating machine and aimed to reduce human reasoning to calculation. Discover his contributions to AI and his vision for building a machine capable of carrying out complex calculations.

michaelaj
Télécharger la présentation

Artificial Intelligence

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Artificial Intelligence CS 165A Thursday, October 25, 2007 • Knowledge and reasoning (Ch 7) • Propositional logic Today 1 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 Gottfried Leibniz (1646-1716) “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.”

  3. Notes X : 2 points O : 3 points • 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 3

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

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

  6. Not allowable 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? LEGAL sentences and TRUE sentences are not the same thing!

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

  8. A knowledge base (KB) entails sentences  KB  • An inference procedurei can derive  from KB KB i  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 Pentail what?

  9. Sentence ENTAILS Semantics FOLLOWS Inference and Entailment (cont.) Sentences Representation Semantics World Facts Fact

  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 Which rules should we apply when? 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

  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 definepropositional 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. P1, P2, etc. (propositions) • ( S1 ) •  S1 • S1 S2 • S1 S2 • S1 S2 • S1  S2 • true • P1 true ( P2  false ) • P  Q  Q  P Propositional Logic • Syntax • True, false, propositional symbols • ( ) ,  (not),  (and),  (or),  (implies),  (equivalent) • Examples of sentences in propositional logic

  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 2N 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

  20. Satisfiability and Validity • Is this true: ( P  Q ) ? • It depends on the values of P and Q • This is asatisfiablesentence – 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 • Thepremise implies the conclusion... or ... • Theantecedentimplies theconsequent • Whatif A  C isalwaystrue? 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 • Alternate notation for inference rule  : “If we know , then we can conclude ” (where  and  are propositional logic sentences)

  24. We’re particularly interested in or KB 1 KB, 1 2 KB, 1, 2 3 KB  1,  2, …  • Inference steps …    Inference 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. Remember: pqp  q,so let’s rewrite it as: or Resolution Rule: one rule for all inferences Propositional calculus resolution 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  Rto 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”

More Related