Artificial Intelligence Chapter 13 The Propositional Calculus

  • Upload
    gaetan

  • View
    31

  • Download
    3

Embed Size (px)

DESCRIPTION

Artificial Intelligence Chapter 13 The Propositional Calculus. Biointelligence Lab School of Computer Sci. & Eng. Seoul National University. Outline. Using Constraints on Feature Values The Language Rules of Inference Definition of Proof Semantics Soundness and Completeness - PowerPoint PPT Presentation

Citation preview

  • Artificial IntelligenceChapter 13The Propositional CalculusBiointelligence LabSchool of Computer Sci. & Eng.Seoul National University

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • (c) 1999-2010 SNU CSE Biointelligence LabOutlineUsing Constraints on Feature ValuesThe LanguageRules of InferenceDefinition of ProofSemanticsSoundness and CompletenessThe PSAT ProblemOther Important Topics*

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • (c) 1999-2010 SNU CSE Biointelligence Lab13.1 Using Constraints on Feature ValuesTwo different methods for modeling an agents world*Feature-based representation : feature vectors

    Iconic representationE.g. mapsSimulations of important aspects of the environmentSometimes called analogical representations

    011101

    1111?10000?10000?100R0?10000???????

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • Feature based representation descriptions of the worldBinary-valued features: what is true about the world and what is not trueeasy to communicateIn cases where the values of some features cannot be sensed directly, their values can be inferred from the values of other features using constraints(c) 1999-2010 SNU CSE Biointelligence Lab*

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • Iconic representation simulations of certain aspects of the worlddata structures and computations that simulate aspects of an agents environment the effects of agent actions upon that environmentmore direct and more efficientRequires elaborate processing for construction or modification(c) 1999-2010 SNU CSE Biointelligence Lab*

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • (c) 1999-2010 SNU CSE Biointelligence LabDifficult or impossible environment to represent iconicallyGeneral laws, such as all blue boxes are pushableNegative information, such as block A is not on the floor (without saying where block A is)Uncertain information, such as either block A is on block B or block A is on block C

    Some of this difficult-to-represent information can be formulated as constraints on the values of featuresThese constraints can be used to infer the values of features that cannot be sensed directly.

    Reasoninginferring information about an agents personal state13.1 Using Constraints on Feature Values (Contd)*

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • (c) 1999-2010 SNU CSE Biointelligence LabApplications involving reasoningReasoning can enhance the effectiveness of agentsTo diagnose malfunction in various physical systemsRepresent the functioning of the systems by appropriate set of featuresConstraints among features encode physical laws relevant to the organism or device.Features associated with causes can be inferred from features associated with symptoms,Expert Systems13.1 Using Constraints on Feature Values (Contd)*

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • (c) 1999-2010 SNU CSE Biointelligence LabMotivating example for reasoning techniquesConsider a robot that is able to lift a block 13.1 Using Constraints on Feature Values (Contd)*LiftableNotLiftableBatteryCausal relation diagramMovesGauge for battery

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • Condition 1: The block is liftable Condition 2: The robots battery power source is adequateIf both are satisfied, then when the robot tries to lift a block it is holding, its arm moves.

    Representing conditions by binary-valued featuresx1 (BAT_OK)x2 (LIFTABLE)x3 (MOVES)(c) 1999-2010 SNU CSE Biointelligence Lab*13.1 Using Constraints on Feature Values (Contd)xi = 0 or 1

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • Let the robot do reasoningFor this we needLanguage expressing constraints and values of featuresInference mechanisms performing required reasoningOne possible tool for this: propositional calculusA descendant of Boolean algebra

    Expressing the constraint of the example in the language of the propositional calculusBAT_OK LIFTABLE MOVES

    (c) 1999-2010 SNU CSE Biointelligence Lab*13.1 Using Constraints on Feature Values (Contd)

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • (c) 1999-2010 SNU CSE Biointelligence LabLogic involvesA language (with a syntax what is a legal expression)Inference ruleSemantics for associating elements of the language with elements of some subject matter

    Two logical languages that you will learnpropositional calculus13.2 Language13.3 Rules of Inference, Ch 14. Resolution13.5 Semanticsfirst-order predicate calculus (FOPC)Ch 15, Ch. 1613.1 Using Constraints on Feature Values (Contd)*

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • Note on NotationsIn the textbookLogical expressions: typewriter font

    Symbols that stand for logical expressions: lowercase Greek letters, , , (c) 1999-2010 SNU CSE Biointelligence Lab*

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • (c) 1999-2010 SNU CSE Biointelligence Lab13.2 The Language - ElementsAtomstwo distinguished atoms T and F and the countably infinite set of those strings of characters that begin with a capital letter, for example, P, Q, R, , P1, P2, ON_A_B, and so on.

    Connectives, , , and , called or, and, implies, and not, respectively.*

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • 13.2 The Language - ElementsSyntax of well-formed formula (wff), also called sentencesAny atom is a wff.If 1 and 2 are wffs, so are 1 2 (disjunction)1 2 (conjunction)1 2 (implication) 1 (negation)

    There are no other wffs.Example: P is not a wff

    (c) 1999-2010 SNU CSE Biointelligence Lab*

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • (c) 1999-2010 SNU CSE Biointelligence Lab13.2 The Language (Contd)Literalatoms and a sign in front of them

    Antecedent and ConsequentIn 1 2, 1 is called the antecedent of the implication.2 is called the consequent of the implication.

    Extra-linguistic separators, ( and )group wffs into (sub) wffs according to the recursive definitions.*

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • (c) 1999-2010 SNU CSE Biointelligence Lab13.3 Rule of InferenceWays by which additional wffs can be produced from other onesCommonly used rulesmodus ponens: wff 2 can be inferred from the wffs 1 and 1 2 introduction: wff 1 2 can be inferred from the two wffs 1 and 2commutativity : wff 2 1 can be inferred from the wff 1 2 elimination: wff 1 can be inferred from the 1 2 introduction: wff 1 2 can be inferred from either from the single wff 1 or from the single wff 2 elimination: wff 1 can be inferred from the wff ( 1 ).*

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • (c) 1999-2010 SNU CSE Biointelligence Lab13.4 Definitions of ProofProofThe sequence of wffs {1, 2, , n} is called a proof (or a deduction) of n from a set of wffs iff each i is either in or can be inferred from a wff earlier in the sequence by using one of the rules of inference.

    TheoremIf there is a proof of n from , n is a theorem of the set . nDenote the set of inference rules by the letter R. R nn can be proved from using the inference rules in R*

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • (c) 1999-2010 SNU CSE Biointelligence LabExampleGiven a set, , of wffs: {P, R, P Q}, {P, P Q, Q, R, Q R} is a proof of Q R.The concept of proof can be based on a partial order.Figure 13.1 A Sample Proof Tree*

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • (c) 1999-2010 SNU CSE Biointelligence Lab13.5 SemanticsTalking about meaningsSemanticsHas to do with associating elements of a logical language with elements of a domain of discourse.Meaning - Such associationsInterpretationAn association of atoms with propositionsDenotationIn a given interpretation, the proposition associated with an atom*

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • (c) 1999-2010 SNU CSE Biointelligence Lab13.5 Semantics (Contd)Under a given interpretation, atoms have values True or False.

    Special AtomT : always has value TrueF : always has value False

    An interpretation by assigning values directly to the atoms in a language can be specified regardless of which proposition about the world each atom denotes.*

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • (c) 1999-2010 SNU CSE Biointelligence LabPropositional Truth Table Given the values of atoms under some interpretation, use a truth table to compute a value for any wff under that same interpretation.

    Let 1 and 2 be wffs.(1 2) has True if both 1 and 2 have value True.(1 2) has True if one or both 1 or 2 have value True. 1 has value True if 1 has value False.The semantics of is defined in terms of and . Specifically, (1 2) is an alternative and equivalent form of ( 1 2) .*

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • (c) 1999-2010 SNU CSE Biointelligence LabPropositional Truth Table (Contd)If an agent describes its world using n features and these features are represented in the agents model of the world by a corresponding set of n atoms, then there are 2n different ways its world can be.

    Given values for the n atoms, the agent can use the truth table to find the values of any wffs.

    Suppose the values of wffs in a set of wffs are given.Do those values induce a unique interpretation?Usually No.Instead, there may be many interpretations that give each wff in a set of wffs the value True .*

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • (c) 1999-2010 SNU CSE Biointelligence LabSatisfiabilityAn interpretation satisfies a wff if the wff is assigned the value True under that interpretation.

    ModelAn interpretation that satisfies a wffIn general, the more wffs that describe the world, the fewer models.

    Inconsistent or UnsatisfiableWhen no interpretation satisfies a wff, the wff is inconsistent or unsatisfiable.e.g. F or P P*BAT_OK LIFTABLE MOVES

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • (c) 1999-2010 SNU CSE Biointelligence LabValidityA wff is said to be validIt has value True under all interpretations of its constituent atoms.e.g.P PT ( P P )Q T[(P Q) P] PP (Q P)Use of the truth table to determine the validity of a wff takes time exponential in the number of atoms*

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • (c) 1999-2010 SNU CSE Biointelligence LabEquivalenceTwo wffs are said to be equivalent iff their truth values are identical under all interpretations.

    DeMorgans laws(1 2) 1 2(1 2) 1 2Law of the contrapositive(1 2) (2 1)If 1 and 2 are equivalent, then the following formula is valid:(1 2) (2 1) abbreviated as 1 2*

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • (c) 1999-2010 SNU CSE Biointelligence LabEntailmentIf a wff has value True under all of interpretations for which each of the wffs in a set has value True, logically entails and logically follows from and is a logical consequence of .

    e.g.{P} P{P, P Q} QF (any wff)P Q P*{BAT_OK, MOVES, BAT_OK LIFTABLE MOVES} LIFTABLE

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • Entailment & Inference(c) 1999-2010 SNU CSE Biointelligence Lab*

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • (c) 1999-2010 SNU CSE Biointelligence Lab13.6 Soundness and CompletenessIf, for any set of wffs, , and wff, , R implies , the set of inference rules, R, is sound.

    If, for any set of wffs, , and wff, , it is the case that whenever , there exist a proof of from using the set of inference rules, we say that R is complete.

    When inference rules are sound and complete, we can determine whether one wff follows from a set of wffs by searching for a proof (instead of by using the truth table).*

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • (c) 1999-2010 SNU CSE Biointelligence Lab13.6 Soundness and Completeness (Contd)*

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • (c) 1999-2010 SNU CSE Biointelligence Lab13.7 The PSAT Problem*ex) BAT_OK LIFTABLEex) (BAT_OK MOVES) (LIFTABLE MOVES)

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • (c) 1999-2010 SNU CSE Biointelligence Lab13.7 The PSAT Problem (Contd)Interesting special cases of the PSAT problem2SAT and 3SATkSAT problemTo find a model for a conjunction of clauses, the longest of which contains exactly k literals2SATPolynomial complexity3SATNP-completeMany problems take only polynomial expected time.*

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • (c) 1999-2010 SNU CSE Biointelligence Lab13.7 The PSAT Problem (Contd)GSAT (Greedy SAT)Nonexhaustive, greedy, hill-climbing type of search procedureBegin by selecting a random set of values for all of the atoms in the formula.The number of clauses having value True under this interpretation is noted.Next, go through the list of atoms and calculate, for each one, the increase in the number of clauses whose values would be True if the value of that atom were to be changed.Change the value of that atom giving the largest increaseTerminated after some fixed number of changesMay terminate at a local maximum*

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • (c) 1999-2010 SNU CSE Biointelligence Lab13.8 Other Important Topics13.8.1 Language DistinctionsThe propositional calculus is a formal language that an artificial agent uses to describe its world.

    Possibility of confusing the informal languages of mathematics and of English with the formal language of the propositional calculus itself.{P, P Q} Q is not a symbol in the language of propositional calculusIt is a symbol in language used to talk about the propositional calculus, : metalinguistic symbolsNever be confused with the symbol *

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • (c) 1999-2010 SNU CSE Biointelligence Lab13.8.2 Metatheorems*

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • (c) 1999-2010 SNU CSE Biointelligence Lab13.8.3 Associative Laws and Distributive LawsAssociative Laws(1 2) 3 1 ( 2 3) (1 2) 3 1 ( 2 3)Distributive Laws1 (2 3) (1 2 ) (1 3)1 (2 3) (1 2 ) (1 3)*

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • Appendix1: Review of the NP-familyNP-hard (non-deterministic polynomial-time hard)As hard as the hardest problems in NP. Such problems need not be in NP; indeed, they may not even be decision problems.

    NP-complete These are the hardest problems in NP. Such a problem is NP-hard and in NP. NP-easy At most as hard as NP, but not necessarily in NP, since they may not be decision problems. NP-equivalent Exactly as difficult as the hardest problems in NP, but not necessarily in NP.(c) 1999-2010 SNU CSE Biointelligence Lab*source: http://en.wikipedia.org/wiki/NP-hardNP is the set of all decision problems for which the 'yes'-answers have efficiently verifiable proofs of the fact that the answer is indeed 'yes'.

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • Appendix 2: GSAT ExampleFlip most-improving variableWhat if first guess is A=1, B=1, C=1?2 clauses satisfiedFlip A to 0 3 clauses satisfiedFlip B to 0 all 4 clauses satisfied (pick this!)Flip C to 0 3 clauses satisfied

    But what if first guess is A=0, B=1, C=1?3 clauses satisfiedFlip A to 1 3 clauses satisfiedFlip B to 0 3 clauses satisfiedFlip C to 0 3 clauses satisfiedPick one anyway (picking A wins on next step)(c) 1999-2010 SNU CSE Biointelligence Lab*A v CA v B~C v ~B~B v ~A

    (c) 1999-2010 SNU CSE Biointelligence Lab

  • (c) 1999-2010 SNU CSE Biointelligence Lab*

    (c) 1999-2010 SNU CSE Biointelligence Lab

    **********************The more we know about the world, the less uncertainty there is about the way it could be.*************An algorithm is said to be polynomial time if its running time is upper bounded by a polynomial in the size of the input for the algorithmT(n) = O(nk) for some constant k***