Artificial Intelligence Lecture 1-2: Representational Methods - - PDF document

artificial intelligence lecture 1 2 representational
SMART_READER_LITE
LIVE PREVIEW

Artificial Intelligence Lecture 1-2: Representational Methods - - PDF document

Artificial Intelligence Lecture 1-2: Representational Methods Propositional Logic and Predicate Logic CS 231: LUMS Lahore Dr. M M Awais Lecture 1-2 Propositional Logic Symbols P,Q,R,S .. Truth Symbols True (T), False (F)


slide-1
SLIDE 1

1

Artificial Intelligence Lecture 1-2: Representational Methods

CS 231: LUMS Lahore

  • Dr. M M Awais
  • Propositional Logic and Predicate Logic

2

Lecture 1-2

Propositional Logic

  • Symbols

P,Q,R,S ……..

  • Truth Symbols

True (T), False (F)

  • Connectives

(and), (or), (Implication), (Equality, equivalence) (not)

Statements (Propositions) could be true/false FACTS are also called Atomic Proposition

slide-2
SLIDE 2

2 3

Lecture 1-2

Truth Table

T T T T F F T T F T T F F F T F F T T T F F T T

P Q

P Q Q P

Q P

Are same 4

Lecture 1-2

Possible Sentences

  • P Q

Conjuncts

  • P Q

Disjuncts

  • P Q

P=Premise/Antecedent Q=conclusion/Consequent

  • P
  • (P Q) = (P Q)

Inter conversion

slide-3
SLIDE 3

3 5

Lecture 1-2

Laws of Propositional Expressions

  • Demorgan’s Law (P V Q)=(P Q)
  • Distributive Law

P V(Q R)= (P Q) (P R)

  • Commutative Law P Q= Q P
  • Associative Law (P Q) R=P (Q R)
  • Contrapositive Law P Q= P Q

6

Lecture 1-2

Inferencing

  • If simple facts are known to be true one can

find the truth value for the expressions

  • Thus INTERPRETATIONS can be done.
  • Interpretation is the assignment of truth

values to the sentences

Symbols T/F Mapping

slide-4
SLIDE 4

4 7

Lecture 1-2

Expressions for KR

  • Fact 1: Ali likes cakes

P

  • Fact 2: Ali eats cakes

Q

  • PQ : Ali Likes cakes or eats cakes
  • PQ : Ali likes cakes and eats ckes
  • Q : Ali does not eat cakes
  • PQ: If Ali likes cakes then he eats cakes
  • PQ:?????

– Above and vice versa

8

Lecture 1-2

Formal Logic Formal Logic

  • The most widely used formal logic method

is FIRST-ORDER PREDICATE LOGIC Components :

Alphabets Formal language Axioms Inference Rules

slide-5
SLIDE 5

5 9

Lecture 1-2

Alphabets Alphabets-

  • I

I

Predicates, variables, functions,constants, connectives, quantifiers, and delimiters Constants: (first letter small) bLUE a color sanTRO a car crow a bird Variables: (first letter capital) Dog: an element that is a dog, but unspecified Color: an unspecified color

10

Lecture 1-2

Alphabets Alphabets-

  • II

II

Function: father(ali) A function that specifies the unique element, that is the father of Ali killer(X) x is a killer

Have arity ‘n=1’ (number of arguments to the function)

Predicate man(shahid) A predicate which gets TRUTH value equal to 1 (or represented by T) when the interpretation is true. Here Shahid is a man so the predicate is true. bigger(ali , father(babar)) Ali is bigger than the father of Babar.

slide-6
SLIDE 6

6 11

Lecture 1-2

Alphabets Alphabets-

  • III

III

Connectives: ^ and v or ~ not Implication (when applied to representing logic

consider implication sentences as IF-THEN rules)

Quantification All persons can see There is a person who cannot see Universal quantifiers Existential quantifiers

12

Lecture 1-2

Examples Examples

My house is a blue, two -story, with red shutters, and is a corner house blue(my-house)^two-story(my-house)^red-shutters(my- house)^corner(my-house) Ali bought a scooter or a car bought(ali , car) v bought(ali , scooter) IF fuel, air and spark are present the fuel will combust present(spark)^present(fuel)^present(air) combustion(fuel)

slide-7
SLIDE 7

7 13

Lecture 1-2

Examples Examples

All people need air ∀X[person(X) need_AIR(X)] The owner of the car also owns the boat [owner(X , car) ^ car(X , boat)] Formulate the following expression in the PC: “Ali is a computer science student but not a pilot or a football player”

cs_STUDENT(ali) ∧ (¬ pilot(ali) ∨ ¬ ft_PLAYER(ali) ) 14

Lecture 1-2

Examples Examples

Restate the sentence in the following way:

  • 1. Ali is a computer science (CS) student
  • 2. Ali is not a pilot
  • 3. Ali is not a football player

cs_student(ali)^ ~pilot(ali)^ ~football_player(ali)

slide-8
SLIDE 8

8 15

Lecture 1-2

Examples Examples

Studying fuzzy systems is exciting and applying logic is great fun if you are not going to spend all of your time slaving

  • ver the terminal

∀ X(~slave_terminal(X)

[fs_eciting(X)^logic_fun(X)]) Every voter either favors the amendment or despises it

∀X[voter(X) [favor(X , amendment) v

despise(X,amendment)] ^ ~[favor(X , amendment) v despise(X , amendment)] (this part simply endorses the statement, may not be required) 16

Lecture 1-2

Undecidable Predicate

  • For which exhaustive testing is required
  • Example:
  • ∀X likes(zahra, X)
  • This sentence is computationally impossible

to calculate

slide-9
SLIDE 9

9 17

Lecture 1-2

Example: Robotic Arm

  • Represent the initial details of the systems
  • Generate sentences of descriptive nature

and or implicative nature

  • Modify the facts using new sentences

A B C D

  • n(b,a)

On( c,d)

  • ntable(b)
  • ntable(d)

clear(a) clear(c) hand_empty 18

Lecture 1-2

Definitions

  • Logically Follows: X logically follows from a set
  • f predicate calculus expressions S if every

interpretation that satisfy S also satisfy X (X F S)

  • Satisfy: If S has value T under interpretation I

then I satisfy S (interpretation that makes the sentence true)

  • Model: If I satisfies S for all variables then I is a

model of S

  • Satisfiable: S is satisfiable iff there exists an

interpretation and variable assignments that satisfy it

slide-10
SLIDE 10

10 19

Lecture 1-2

S F X

S: All birds fly S: Sparrow is bird X: Sparrow flies All humans are mortal Shahid is a human Shahis is mortal All birds fly Sparrow is bird Sparrow flies

20

Lecture 1-2

Definitions

  • Inconsistent: If a set of expressions are not satisfiable
  • Valid:If any expression has a value T for all

possible interpertations

  • Sound: If an expression logically follows from

another expression then the inferential rule is sound

  • Complete: When inferential rule produces every

expression that logically follows a particular expression

slide-11
SLIDE 11

11 21

Lecture 1-2

Operations

  • Unification: Algorithm for determining the

subitutions needed to make two predicate calculus expressions match

  • Skolemization: A method of removing or

replacing existential quantifiers

  • Composition: If S and S` are two substitutions

sets, then the composition of S and S` (SS`) is

  • btained by applying the elements of S to the

elements of S` and finally adding the results