+ All Categories
Home > Documents > 16368_15840-UNIT IV

16368_15840-UNIT IV

Date post: 10-Feb-2018
Category:
Upload: sidharth-sundaresan
View: 220 times
Download: 0 times
Share this document with a friend

of 59

Transcript
  • 7/22/2019 16368_15840-UNIT IV

    1/59

    Artificial IntelligenceCourse Code: ECE434 UNIT -IV

  • 7/22/2019 16368_15840-UNIT IV

    2/59

    SyllabusUNIT

    1. Introduction to Artificial Intelligence

    2. Problem Solving : state-space Search And Control Strategies

    3. Problem Reduction And Game Playing

    4. Logic Concept And Logic Programming

    5. Prolog Programming Language

    MID TERM

    1. Knowledge Representations

    2. Expert Systems And Applications

    3. Uncertainty Measure: Probability Theory And Fuzzy Logic

    4. Machine Learning, Ann And Evolutionary Computation

    5. Introduction To Intelligent Agents And Natural Language

    Processing

  • 7/22/2019 16368_15840-UNIT IV

    3/59

    References

    Text

    1. Artificial Intelligence Saroj Kaushik 1st Edition

    Cengage Learning 2011

    Reference Books

    2. Introduction to Artificial Intelligence and ExpertSystems Dan. W. Patterson 1st Edition 1990 PHI(Pretice Hall India).

    3. Artificial Intelligence- A Modern Approach

    Stuart Russel Peter Norvig 3rd Edition Pearson, 2009 .

    4. Artificial Intelligence Elaine Rich Kevin Knight3rd Edition 2008 Tata McGraw Hill, India

  • 7/22/2019 16368_15840-UNIT IV

    4/59

    Topics to be covered in Unit IV

    Logic & its Concepts

    Meaning of Logic & its need

    What is Symbolic Logic & its Types

    Propositional Logic and Predicate Logic

    Various methods for proving the validity of the formulae: Natural Deduction System

    Axiomatic System

    Semantic Tableau Method

    Resolution Refutation Method

    Predicate Logic

    Logic Programming

  • 7/22/2019 16368_15840-UNIT IV

    5/59

    INTRODUCTION TO LOGIC CONCEPTS &LOGIC PROGRAMMING

    Logic was to be a branch of philosophy;however formal logic has been studied in the

    context of foundation of mathematics where it

    is referred to as symbolic logic. Logic is concerned with the principles of

    drawing valid inferences from a given set of

    true statements. Hence, it is referred to as symbolic logic.

  • 7/22/2019 16368_15840-UNIT IV

    6/59

    LOGICLogic is concerned with the truth of statements about the world.

    Generally each statement is either TRUE or FALSE. Logic includes : Syntax ,

    Semantics and Inference Procedure.

    Syntax :

    Specifies the symbols in the language about how they can be combined toform sentences. The facts about the world are represented as sentences in

    logic.

    Semantic :

    Specifies how to assign a truth value to a sentence based on its meaning in

    the world. It Specifies what facts a sentence refers to. A fact is a claim about

    the world, and it may be TRUE or FALSE.

    Inference Procedure :

    Specifies methods for computing new sentences from an existing sentences.

  • 7/22/2019 16368_15840-UNIT IV

    7/59

    Branches of Symbolic logic

    It is divided into 2 branches: Propositional logic

    Predicate logic

    A Proposition refers to a declarative statementthat is either true or false (but not both) in agiven context.

    One can infer a new proposition from a givenset of propositions in the same context usinglogic.

  • 7/22/2019 16368_15840-UNIT IV

    8/59

    Example of Propositional Logic

  • 7/22/2019 16368_15840-UNIT IV

    9/59

    Propositional Calculus

    Propositional Calculus (PC) refers to a languageof propositions in which a set of rules are used

    to combine simple propositions to form

    compound propositions with the help ofcertain logical operators.

    These logical operators are also called as

    connectives; These operators are: not(~), or (v), and (^),

    implies ( ), and equivalence ( ).

  • 7/22/2019 16368_15840-UNIT IV

    10/59

    Well-formed formula (wff)

    A wff is defined is defined as a symbol or a stringof symbols generated by the formal grammar of aformal language of a formal language.

    Properties of wff:

    The smallest unit (or an atom) is considered to beal wff.

    If is a wff , then ~ is also a wff. If and are wff, then (^ ), ( ), ( ) and

    ( ) are also wff.

  • 7/22/2019 16368_15840-UNIT IV

    11/59

    Truth Table to prove PC

    In Propositional Calculus (PC) is used to provide

    operational definitions of important logical

    operators.

    The logical constants in PC are true or False

    and these are represented as T or F.

  • 7/22/2019 16368_15840-UNIT IV

    12/59

    Truth Table for PC

    A B ~A A^B AB AB AB

    T T F T T T T

    T F F F T F F

    F T T F T T F

    F F T F F T T

  • 7/22/2019 16368_15840-UNIT IV

    13/59

    Do it yourself

    Compute the truth value of using truth table

    approach.

    : (A V B) ^ (~B A)

  • 7/22/2019 16368_15840-UNIT IV

    14/59

    Equivalence Laws

    NAME OF THE RELATION EQUIVALENCE RELATIONS

    Commutative Law A v B B v A

    A ^ B B ^ A

    Associative Law A v (B v C) (A v B) v C

    A ^ (B ^ C) (A ^ B) ^ C

    Double Negation ~ (~A) A

    Distributive Laws A v (B ^ C) (A v B) ^ (A v C)

    A ^ (B v C) (A ^ B) v (A ^ C)

    De Morgans Laws ~(A v B) ~A ^ ~B

    ~(A ^ B) ~A v ~B

  • 7/22/2019 16368_15840-UNIT IV

    15/59

    Equivalence Laws

    NAME OF THE RELATION EQUIVALENCE RELATIONS

    Absorption Laws A v (A ^ B) A

    A ^ (A v B) A

    A v (~A ^ B) A v BA ^ (~A v B) A ^ B

    Idempotence A v A A

    A ^ A A

    Excluded Middle Law A v ~A T (True)

    Contradiction Law A ^ ~ A F (False)

    Commonly Used Equivalence Relations A B ~A v B

    A B (A B) ^ (B A)

    (A ^ B) v (~A ^ ~B)

  • 7/22/2019 16368_15840-UNIT IV

    16/59

    Propositional Logic

    Propositional logic deals with the validity,

    satisfiability (also called consistency) and

    unsatisfiability (inconsistency) of a formula andthe derivation of a new formula using

    equivalence laws.

  • 7/22/2019 16368_15840-UNIT IV

    17/59

    Propositional Logic

    The validity, satisfiability, and unsatisfiability ofa formula may be determined on the basis of

    the following conditions:

    A formula is said to be valid if and only if it isa tautology.

    A formula is said to be satisfiable if there

    exists at least one interpretation for which istrue.

    A formula is said to be unsatisfiable if the

    value of is false under all interpretations.

  • 7/22/2019 16368_15840-UNIT IV

    18/59

    Example

    Show that the following is a valid argument:

    If it is humid then it willrain and since it is humidtoday it will rain

  • 7/22/2019 16368_15840-UNIT IV

    19/59

    Solution to the Example

    Let us symbolize each part of the English

    sentence by propositional atoms as follows:

    A: It is humid

    B: It will rain

    Formula can be represented as:

    : *(A B) ^ A+ B

    Now Solve it to calculate the value of this formula

    using Truth Table method

    Ad t & Di d t f thi

  • 7/22/2019 16368_15840-UNIT IV

    20/59

    Advantages & Disadvantage of thismethod for evaluating any formula

    Advantage:

    The Truth Table approach is simple and straightforward method by

    providing truth values in a given situation.

    It is an easy method for evaluating consistency, inconsistency, or validity of

    a formula.

    Disadvantage:

    As no. of values grows, the size of truth table grows exponentially.

    For example: in order to validate : (A ^ B ^ C ^ D) (B v E), we require 32

    rows and compute the value of for all the 32 interpretations.

    Hence, use of truth table approach proves to be wastage of time for various

    cases. Therefore, we require some other methods which can help in proving

    the validity of the formula directly.

    V i th d f f &

  • 7/22/2019 16368_15840-UNIT IV

    21/59

    Various methods for proofs &Deduction

    Some methods apart from the Truth Table

    method that are concerned with proofs and

    deductions are as follows:

    Natural Deduction System

    Axiomatic System

    Semantic Tableau Method Resolution Refutation Method

  • 7/22/2019 16368_15840-UNIT IV

    22/59

    Natural Deduction system

    Natural deduction system (NDS) is called so

    because of the fact that it mimics the pattern

    of natural reasoning.

    NDS is based on a set of deductive inference

    rules.

  • 7/22/2019 16368_15840-UNIT IV

    23/59

    NDS Rules Table

    RULE NAME SYMBOL RULE DESCRIPTION

    Introducing ^ (I: ^) If A1, ..An then

    A1^.^An

    IfA1, A2,An is true, then

    their conjunction is also true.

    Eliminating ^ (E:^) IfA1^ A2 ^^An

    then Ai(1

  • 7/22/2019 16368_15840-UNIT IV

    24/59

    NDS Rules Table

    RULE NAME SYMBOL RULE DESCRIPTION

    Introducing (I: )If from 1,. n infer is proved then

    1,n is proved

    If given that 1, n are true andfrom these we deduce then 1^

    2^n is also true

    Eliminating (E:) If A1A, A1 , then A If A1A is true and A1 is also true,then A is also true. This is called as

    Modus Ponen (MP) rule

    Introducing (I: ) If A1A2, A2A1, then

    A1 A2

    If A1A2 and A2A1 is true, then

    A1 A2 is also true

    Eliminating (E:) IfA1 A2 then A1A2,

    A2A1

    IfA1 A2 is true then A1A2 &

    A2A1 are also true

    Introducing ~ (I: ~) If from A infer A1 ^ ~A1 is

    proved then ~A is proved

    If from A (which is true), a

    contradiction is proved then truth

    of ~A is also proved

  • 7/22/2019 16368_15840-UNIT IV

    25/59

    Example

    Prove that A ^ (B v C) is deduced from A ^ B

    Description Formula Comments

    Theorem From A^B infer A^(BvC) To be proved

    Hypothesis(given) A ^ B 1

    E: ^(1) A 2

    E: ^(1) B 3

    I: v(3) B v C 4

    I: ^(2,4) A ^ (B v C) Proved

  • 7/22/2019 16368_15840-UNIT IV

    26/59

    Example: NDS HOMEWORK

    Prove the theorem infer *(A B) ^ (B C)+ (A C)

  • 7/22/2019 16368_15840-UNIT IV

    27/59

    Axiomatic System

    The axiomatic system is based on a set of 3 axioms and onerule of deduction.

    In axiomatic system, the proofs of the theorem are often

    difficult and require a guess in selection of appropriate axiom.

    In this system, only two operators are used to form a formula:

    not (~) and implies ().

    These can be converted as follows:

    A ^ B ~(~A v B) ~(A~B)

    A v B ~A B

    A B (A B) ^ (B A) ~[(A B) ~ (B A) ]

  • 7/22/2019 16368_15840-UNIT IV

    28/59

    3 Axioms & 1Rule

    Axiom 1: ( )

    Axiom 2: [ ( )] [( ) ( )]

    Axiom 3: (~ ~) ( )

    Modus Ponen Rule

    Hypothesis: , and , Consequent:

  • 7/22/2019 16368_15840-UNIT IV

    29/59

    Example

    Establish that A C is a deductive consequence

    of A B, B C-

    Description Formula Comments

    Theorem A B, B C- - (A C) ProveHypothesis 1 A B 1

    Hypothesis 2 B C 2

    Instance of Axiom 1 (B C) *A (B C)+ 3

    MP(2,3) [A (B C)+ 4

    Instance of Axiom 2 [A (BC)+ *(AB) (AC)+ 5

    MP(4,5) (A B) (A C) 6

    MP(1,6) (A C) Proved

    Semantic Tableau System in

  • 7/22/2019 16368_15840-UNIT IV

    30/59

    Semantic Tableau System inPropositional Logic

    Semantic tableau is a binary tree which is

    constructed by using semantic tableau rules

    with a formula as a root.

    Both NDS and Axiomatic System uses forward

    Chaining Approach.

    Semantic tableau methods as well as

    Resolution Refutation method uses backward

    chaining method.

  • 7/22/2019 16368_15840-UNIT IV

    31/59

    Semantic Tableau Rules list 1

  • 7/22/2019 16368_15840-UNIT IV

    32/59

    Semantic Tableau Rules list 2

  • 7/22/2019 16368_15840-UNIT IV

    33/59

    Semantic Tableau Rules list 3

  • 7/22/2019 16368_15840-UNIT IV

    34/59

    Example: Semantic Tableau

  • 7/22/2019 16368_15840-UNIT IV

    35/59

    Example: Semantic Tableau.

  • 7/22/2019 16368_15840-UNIT IV

    36/59

    Example: Semantic Tableau.

    Resolution Refutation in

  • 7/22/2019 16368_15840-UNIT IV

    37/59

    Resolution Refutation inPropositional Logic

    Clause is defined as a special formula

    containing the boolean operators ~ and v.

    Resolution Refutation method is the most

    favoured method for developing computer

    based systems that can be used to prove

    theorems automatically.

    In this method, the negation of the goal to beproved is added to the given set of clauses, and

    using the resolution principle, it is shown that

    there is a refutation in the new set.

    Conversion of Formula to set of

  • 7/22/2019 16368_15840-UNIT IV

    38/59

    Conversion of Formula to set ofClauses

    There are 2 Normal Forms:

    Disjunctive Normal Form (DNF)

    Conjunctive Normal Form (CNF)

  • 7/22/2019 16368_15840-UNIT IV

    39/59

    Conversion of a Formula to its CNF

    Eliminate double negation signs by using

    ~(~A) A

    Use De Morgans law to push ~(negation) immediately before the

    atomic formula

    ~(A ^ B) ~A v ~B

    ~(A v B) ~A ^ ~B

    Use Distributive law to get CNF

    A v (B ^ C) (A v B) ^ (A v C)

    Eliminate the & by using following equivalence laws:

    A B ~ A v B

    A B (A B) ^ (B A)

  • 7/22/2019 16368_15840-UNIT IV

    40/59

    Resolution of Clauses

    Two clauses can be resolved by eliminating

    complimentary pair of literals, from both.

    A new clause is formed by disjunction of the

    remaining literals in both the clauses.

    The complimentary literals are resolved

    together by deleting complimentary literals

    and hence a new clause is formed.

  • 7/22/2019 16368_15840-UNIT IV

    41/59

    Example of Resolution

  • 7/22/2019 16368_15840-UNIT IV

    42/59

    Example of Resolution

  • 7/22/2019 16368_15840-UNIT IV

    43/59

    Predicate Logic

    It is the extension of Propositional Logic.

    Due to the disadvantages of propositionallogic, there is the need of predicate logic.

    It will provide more better inferencing and alsoto have common validation mechanism.

  • 7/22/2019 16368_15840-UNIT IV

    44/59

    Predicate Logic

    The propositional logic, is not powerful enough for all types of

    assertions;

    Example : The assertion "x > 1", where x is a variable, is not a

    proposition because it is neither true nor false unless value of x

    is defined.

    For x > 1 to be a proposition ,

    either we substitute a specific number for x ;

    or change it to something like

    "There is a number x for which x > 1 holds";

    or "For every number x, x > 1 holds".

  • 7/22/2019 16368_15840-UNIT IV

    45/59

    Predicate logic

    Consider example :

    All men are mortal.

    Socrates is a man.

    Then Socrates is mortal ,

    These cannot be expressed in propositional logic as a finite and logicallyvalid argument (formula).

    We need languages : that allow us to describe properties (predicates)

    of objects, or a relationship among objects represented by the

    variables .

    Predicate logic satisfies the requirements of a language.

    Predicate logic is powerful enough for expression and reasoning.

    Predicate logic is built upon the ideas of propositional logic.

  • 7/22/2019 16368_15840-UNIT IV

    46/59

    Using Predicate Logic

    1. Marcus was a man.

    2. Marcus was a Pompeian.

    3. All Pompeians were Romans.

    4. Caesar was a ruler.

    5. All Pompeians were either loyal to Caesar or hated him.

    6. Every one is loyal to someone.

    7. People only try to assassinate rulers they are not loyal to.

    8. Marcus tried to assassinate Caesar.

  • 7/22/2019 16368_15840-UNIT IV

    47/59

    Predicate Logic Example

    1. Marcus was a man.

    man(Marcus)

    2. Marcus was a Pompeian.

    Pompeian(Marcus)

    3. All Pompeians were Romans.

    x: Pompeian(x) Roman(x)

    4. Caesar was a ruler.

    ruler(Caesar)

  • 7/22/2019 16368_15840-UNIT IV

    48/59

    Predicate Logic Example

    5. All Pompeians were either loyal to Caesar or hated him.

    inclusive-or

    x: Pompeians (x) loyalto(x, Caesar) hate(x, Caesar)

    exclusive-or

    x: Pompeians (x) (loyalto(x, Caesar) hate(x, Caesar))

    (loyalto(x, Caesar) hate(x, Caesar))

  • 7/22/2019 16368_15840-UNIT IV

    49/59

    Predicate Logic Example...

    6. Every one is loyal to someone.

    x: y: loyalto(x, y)

    y: x: loyalto(x, y)

    P di t L i E l

  • 7/22/2019 16368_15840-UNIT IV

    50/59

    Predicate Logic Example

    7. People only try to assassinate rulers they

    are not loyal to.

    x: y: person(x) ruler(y) tryassassinate(x, y) loyalto(x, y)

    8. Marcus tried to assassinate Caesar.

    tryassassinate(Marcus, Caesar)

  • 7/22/2019 16368_15840-UNIT IV

    51/59

    Using Predicate Logic

    Was Marcus loyal to Caesar?

    Using 7 & 8 fact, we can predict

    Backward chaining

    man(Marcus)

    ruler(Caesar)

    tryassassinate(Marcus, Caesar)

    x: man(x) person(x)loyalto(Marcus, Caesar)

  • 7/22/2019 16368_15840-UNIT IV

    52/59

    Resolution

    The basic ideas

    KB |= KB |=false

    () () ()

    sound and complete

  • 7/22/2019 16368_15840-UNIT IV

    53/59

    Conversion to Clause Form1. Eliminate .

    P Q P Q

    2. Reduce the scope of each to a single term.

    (P Q) P Q

    (P Q) P Qx: P x: P

    x: p x: P

    P P

    3. Standardize variables so that each quantifier binds a uniquevariable.

    (x: P(x)) (x: Q(x)) (x: P(x)) (y: Q(y))

  • 7/22/2019 16368_15840-UNIT IV

    54/59

    Conversion to Clause Form

    4. Move all quantifiers to the left without changing their relative order.(x: P(x)) (y: Q(y)) x: y: (P(x) (Q(y))

    5. Eliminate (Skolemization).

    x: P(x) P(c) Skolem constant

    x:y P(x, y) x: P(x, f(x)) Skolem function

    6. Drop.

    x: P(x) P(x)

    7. Convert the formula into a conjunction of disjuncts.

    (P Q) R (P R) (Q R)

    8. Create a separate clause corresponding to each conjunct.

    9. Standardize apart the variables in the set of obtained clauses.

    Con ersion to Cla se Form S mmar

  • 7/22/2019 16368_15840-UNIT IV

    55/59

    Conversion to Clause Form Summary

    1. Eliminate .2. Reduce the scope of each to a single term.

    3. Standardize variables so that each quantifier binds a unique variable.

    4. Move all quantifiers to the left without changing their relative order.

    5. Eliminate (Skolemization).

    6. Drop.

    7. Convert the formula into a conjunction of disjuncts.

    8. Create a separate clause corresponding to each conjunct.

    9. Standardize apart the variables in the set of obtained clauses.

  • 7/22/2019 16368_15840-UNIT IV

    56/59

    Example1. Marcus was a man.

    2. Marcus was a Pompeian.

    3. All Pompeians were Romans.

    4. Caesar was a ruler.

    5. All Pompeians were either loyal to Caesar or hated him.

    6. Every one is loyal to someone.

    7. People only try to assassinate rulers they are not loyal to.

    8. Marcus tried to assassinate Caesar.

  • 7/22/2019 16368_15840-UNIT IV

    57/59

    Example1. Man(Marcus).

    2. Pompeian(Marcus).

    3. x: Pompeian(x) Roman(x).

    4. ruler(Caesar).

    5. x: Roman(x) loyalto(x, Caesar) hate(x, Caesar).6. x: y: loyalto(x, y).

    7. x: y: person(x) ruler(y) tryassassinate(x, y)

    loyalto(x, y).

    8. tryassassinate(Marcus, Caesar).

  • 7/22/2019 16368_15840-UNIT IV

    58/59

    Example

    Prove:hate(Marcus, Caesar)

  • 7/22/2019 16368_15840-UNIT IV

    59/59

    More Questions that can be raised

    1. When did Marcus die?

    2. Whom did Marcus hate?

    3. Who tried to assassinate a ruler?

    4. What happen in 79 A.D.?.

    5. Did Marcus hate everyone?


Recommended