Outline. Why FOL? Syntax and semantics of FOL Using FOL. Knowledge engineering in FOL

Size: px
Start display at page:

Download "Outline. Why FOL? Syntax and semantics of FOL Using FOL. Knowledge engineering in FOL"

Transcription

1 First-Order Logic

2 Outline Why FOL? Syntax and semantics of FOL Using FOL Wumpus world in FOL Knowledge engineering in FOL

3 Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem proving forward chaining backward chaining resolution

4 Pros and cons of propositional logic Propositional logic is declarative Propositional logic allows partial/disjunctive/negated information (unlike most data structures and databases) Propositional logic is compositional: meaning of B 1,1 P 1,2 is derived from meaning of B 1,1 and of P 1,2 Meaning in propositional logic is context-independent (unlike natural language, where meaning depends on context) Propositional logic has very limited expressive power

5 First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes the world contains Objects: people, houses, numbers, colors, baseball games, wars, Relations: red, round, prime, brother of, bigger than, part of, comes between, Functions: father of, best friend, one more than, plus,

6 Syntax of FOL: Basic elements Constants KingJohn, 2, NUS,... Predicates Brother, >,... Functions Sqrt, LeftLegOf,... Variables x, y, a, b,... Connectives,,,, Equality = Quantifiers,

7 Atomic sentences Atomic sentence = predicate (term 1,...,term n ) or term 1 = term 2 Term = function (term 1,...,term n ) or constant or variable E.g., Brother(KingJohn,RichardTheLionheart) > (Length(LeftLegOf(Richard)), Length(LeftLegOf(KingJohn)))

8 Complex sentences Complex sentences are made from atomic sentences using connectives S, S 1 S 2, S 1 S 2, S 1 S 2, S 1 S 2, E.g. Sibling(KingJohn,Richard) Sibling(Richard,KingJohn) >(1,2) (1,2) >(1,2) >(1,2)

9 Truth in first-order logic Sentences are true with respect to a model and an interpretation Model contains objects (domain elements) and relations among them Interpretation specifies referents for constant symbols objects predicate symbols relations function symbols functional relations An atomic sentence predicate(term 1,...,term n ) is true iff the objects referred to by term 1,...,term n are in the relation referred to by predicate

10 Models for FOL: Example

11 Universal quantification <variables> <sentence> Everyone at NUS is smart: x At(x,NUS) Smart(x) x P is true in a model m iff P is true with x being each possible object in the model Roughly speaking, equivalent to the conjunction of instantiations of P At(KingJohn,NUS) Smart(KingJohn) At(Richard,NUS) Smart(Richard) At(NUS,NUS) Smart(NUS)

12 A common mistake to avoid Typically, is the main connective with Common mistake: using as the main connective with : x At(x,NUS) Smart(x) means Everyone is at NUS and everyone is smart

13 Existential quantification <variables> <sentence> Someone at NUS is smart: x At(x,NUS) Smart(x)$ x P is true in a model m iff P is true with x being some possible object in the model Roughly speaking, equivalent to the disjunction of instantiations of P At(KingJohn,NUS) Smart(KingJohn) At(Richard,NUS) Smart(Richard) At(NUS,NUS) Smart(NUS)...

14 Another common mistake to avoid Typically, is the main connective with Common mistake: using as the main connective with : x At(x,NUS) Smart(x) is true if there is anyone who is not at NUS!

15 Properties of quantifiers x y is the same as y x x y is the same as y x x y is not the same as y x x y Loves(x,y) There is a person who loves everyone in the world y x Loves(x,y) Everyone in the world is loved by at least one person Quantifier duality: each can be expressed using the other x Likes(x,IceCream) x Likes(x,IceCream)

16 Equality term 1 = term 2 is true under a given interpretation if and only if term 1 and term 2 refer to the same object E.g., definition of Sibling in terms of Parent: x,y Sibling(x,y) [ (x = y) m,f (m = f) Parent(m,x) Parent(f,x) Parent(m,y) Parent(f,y)]

17 Using FOL The kinship domain: Brothers are siblings x,y Brother(x,y) Sibling(x,y) One's mother is one's female parent m,c Mother(c) = m (Female(m) Parent(m,c)) Sibling is symmetric

18 Using FOL The set domain: s Set(s) (s = {} ) ( x,s 2 Set(s 2 ) s = {x s 2 }) x,s {x s} = {} x,s x s s = {x s} x,s x s [ y,s 2 } (s = {y s 2 } (x = y x s 2 ))] s 1,s 2 s 1 s 2 ( x x s 1 x s 2 ) s 1,s 2 (s 1 = s 2 ) (s 1 s 2 s 2 s 1 )

19 Interacting with FOL KBs Suppose a wumpus-world agent is using an FOL KB and perceives a smell and a breeze (but no glitter) at t=5: Tell(KB,Percept([Smell,Breeze,None],5)) Ask(KB, a BestAction(a,5)) I.e., does the KB entail some best action at t=5? Answer: Yes, {a/shoot} substitution (binding list) Given a sentence S and a substitution σ, Sσ denotes the result of plugging σ into S; e.g., S = Smarter(x,y) σ = {x/hillary,y/bill} Sσ = Smarter(Hillary,Bill) Ask(KB,S) returns some/all σ such that KB σ

20 Knowledge base for the wumpus world Perception t,s,b Percept([s,b,Glitter],t) Glitter(t) Reflex t Glitter(t) BestAction(Grab,t)

21 Deducing hidden properties x,y,a,b Adjacent([x,y],[a,b]) [a,b] {[x+1,y], [x-1,y],[x,y+1],[x,y-1]} Properties of squares: s,t At(Agent,s,t) Breeze(t) Breezy(s) Squares are breezy near a pit: Diagnostic rule---infer cause from effect s Breezy(s) \Exi{r} Adjacent(r,s) Pit(r)$

22 Knowledge engineering in FOL 1. Identify the task Assemble the relevant knowledge Decide on a vocabulary of predicates, functions, and constants Encode general knowledge about the domain Encode a description of the specific problem instance 6.

23 The electronic circuits domain One-bit full adder

24 The electronic circuits domain 1. Identify the task 2. Does the circuit actually add properly? (circuit verification) 2. Assemble the relevant knowledge 3. Composed of wires and gates; Types of gates (AND, OR, XOR, NOT) Irrelevant: size, shape, color, cost of gates 3. Decide on a vocabulary 4.

25 The electronic circuits domain 4. Encode general knowledge of the domain 5. t 1,t 2 Connected(t 1, t 2 ) Signal(t 1 ) = Signal(t 2 ) t Signal(t) = 1 Signal(t) = t 1,t 2 Connected(t 1, t 2 ) Connected(t 2, t 1 ) g Type(g) = OR Signal(Out(1,g)) = 1 n Signal(In(n,g)) = 1 g Type(g) = AND Signal(Out(1,g)) = 0 n Signal(In(n,g)) = 0

26 The electronic circuits domain 5. Encode the specific problem instance 6. Type(X 1 ) = XOR Type(A 1 ) = AND Type(O 1 ) = OR Type(X 2 ) = XOR Type(A 2 ) = AND Connected(Out(1,X 1 ),In(1,X 2 )) Connected(In(1,C 1 ),In(1,X 1 )) Connected(Out(1,X 1 ),In(2,A 2 )) Connected(In(1,C 1 ),In(1,A 1 )) Connected(Out(1,A 2 ),In(1,O 1 )) Connected(In(2,C 1 ),In(2,X 1 )) Connected(Out(1,A 1 ),In(2,O 1 )) Connected(In(2,C 1 ),In(2,A 1 )) Connected(Out(1,X 2 ),Out(1,C 1 )) Connected(In(3,C 1 ),In(2,X 2 )) Connected(Out(1,O 1 ),Out(2,C 1 )) Connected(In(3,C 1 ),In(1,A 2 ))

27 The electronic circuits domain 6. Pose queries to the inference procedure 7. What are the possible sets of values of all the terminals for the adder circuit? i 1,i 2,i 3,o 1,o 2 Signal(In(1,C_1)) = i 1 Signal(In(2,C 1 )) = i 2 Signal(In(3,C 1 )) = i 3 Signal(Out(1,C 1 )) = o 1 Signal(Out(2,C 1 )) = o 2 7. Debug the knowledge base

28 Summary First-order logic: objects and relations are semantic primitives syntax: constants, functions, predicates, equality, quantifiers Increased expressive power: sufficient to define wumpus world

29 Logical Agents

30 Knowledge bases Knowledge base = set of sentences in a formal language Declarative approach to building an agent (or other system): Tell it what it needs to know Then it can Ask itself what to do - answers should follow from the KB Agents can be viewed at the knowledge level i.e., what they know, regardless of how implemented Or at the implementation level i.e., data structures in KB and algorithms that manipulate them

31 A simple knowledge-based agent The agent must be able to: Represent states, actions, etc. Incorporate new percepts Update internal representations of the world Deduce hidden properties of the world

32 Wumpus World PEAS description Performance measure gold +1000, death per step, -10 for using the arrow Environment Squares adjacent to wumpus are smelly Squares adjacent to pit are breezy Glitter iff gold is in the same square Shooting kills wumpus if you are facing it Shooting uses up the only arrow

33 Wumpus world characterization Fully Observable No only local perception Deterministic Yes outcomes exactly specified Episodic No sequential at the level of actions Static Yes Wumpus and Pits do not move Discrete Yes

34 Exploring a wumpus world

35 Exploring a wumpus world

36 Exploring a wumpus world

37 Exploring a wumpus world

38 Exploring a wumpus world

39 Exploring a wumpus world

40 Exploring a wumpus world

41 Exploring a wumpus world

42 Logic in general Logics are formal languages for representing information such that conclusions can be drawn Syntax defines the sentences in the language Semantics define the "meaning" of sentences; i.e., define truth of a sentence in a world E.g., the language of arithmetic x+2 y is a sentence; x2+y > {} is not a sentence

43 Entailment Entailment means that one thing follows from another: KB α Knowledge base KB entails sentence α if and only if α is true in all worlds where KB is true E.g., the KB containing the Giants won and the Reds won entails Either the Giants won or the Reds won E.g., x+y = 4 entails 4 = x+y Entailment is a relationship between sentences (i.e.,

44 Models Logicians typically think in terms of models, which are formally structured worlds with respect to which truth can be evaluated We say m is a model of a sentence α if α is true in m M(α) is the set of all models of α Then KB α iff M(KB) M(α) E.g. KB = Giants won and Reds won α = Giants won

45 Entailment in the wumpus world Situation after detecting nothing in [1,1], moving right, breeze in [2,1] Consider possible models for KB assuming only pits 3 Boolean choices 8 possible models

46 Wumpus models

47 Wumpus models KB = wumpus-world rules + observations

48 Wumpus models KB = wumpus-world rules + observations α 1 = "[1,2] is safe", KB α 1, proved by model checking

49 Wumpus models KB = wumpus-world rules + observations

50 Wumpus models KB = wumpus-world rules + observations α 2 = "[2,2] is safe", KB α 2

51 Inference KB i α = sentence α can be derived from KB by procedure i Soundness: i is sound if whenever KB i α, it is also true that KB α Completeness: i is complete if whenever KB α, it is also true that KB i α Preview: we will define a logic (first-order logic) which is expressive enough to say almost anything of interest, and for which there exists a sound and complete inference procedure.

52 Propositional logic: Syntax Propositional logic is the simplest logic illustrates basic ideas The proposition symbols P 1, P 2 etc are sentences If S is a sentence, S is a sentence (negation) If S 1 and S 2 are sentences, S 1 S 2 is a sentence (conjunction) If S 1 and S 2 are sentences, S 1 S 2 is a sentence (disjunction) If S 1 and S 2 are sentences, S 1 S 2 is a sentence (implication) If S 1 and S 2 are sentences, S 1 S 2 is a sentence (biconditional)

53 Propositional logic: Semantics Each model specifies true/false for each proposition symbol E.g. P 1,2 P 2,2 P 3,1 false true false With these symbols, 8 possible models, can be enumerated automatically. Rules for evaluating truth with respect to a model m: S is true iff S is false S 1 S 2 is true iff S 1 is true and S 2 is true S 1 S 2 is true iff S 1 is true or S 2 is true S 1 S 2 is true iff S 1 is false or S 2 is true i.e., is false iff S 1 is true and S 2 is false S 1 S 2 is true iff S 1 S 2 is true ands 2 S 1 is true Simple recursive process evaluates an arbitrary sentence, e.g.,

54 Truth tables for connectives

55 Wumpus world sentences Let P i,j be true if there is a pit in [i, j]. Let B i,j be true if there is a breeze in [i, j]. P 1,1 B 1,1 B 2,1 "Pits cause breezes in adjacent squares" B 1,1 (P 1,2 P 2,1 ) B 2,1 (P 1,1 P 2,2 P 3,1 )

56 Truth tables for inference

57 Inference by enumeration Depth-first enumeration of all models is sound and complete For n symbols, time complexity is O(2 n ), space complexity is O(n)

58 Logical equivalence Two sentences are logically equivalent} iff true in same models: α ß iff α β and β α

59 Validity and satisfiability A sentence is valid if it is true in all models, e.g., True, A A, A A, (A (A B)) B Validity is connected to inference via the Deduction Theorem: KB α if and only if (KB α) is valid A sentence is satisfiable if it is true in some model e.g., A B, C A sentence is unsatisfiable if it is true in no models e.g., A A Satisfiability is connected to inference via the following: KB α if and only if (KB α) is unsatisfiable

60 Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules Legitimate (sound) generation of new sentences from old Proof = a sequence of inference rule applications Can use inference rules as operators in a standard search algorithm Typically require transformation of sentences into a normal form Model checking truth table enumeration (always exponential in n) improved backtracking, e.g., Davis--Putnam-Logemann-Loveland

61 Resolution Conjunctive Normal Form (CNF) conjunction of disjunctions of literals clauses E.g., (A B) (B C D) Resolution inference rule (for CNF): l i l k, m 1 m n l i l i-1 l i+1 l k m 1 m j-1 m j+1... m n where l i and m j are complementary literals. E.g., P 1,3 P 2,2, P 2,2 P 1,3

62 Resolution Soundness of resolution inference rule: (l i l i-1 l i+1 l k ) l i m j (m 1 m j-1 m j+1... m n ) (l i l i-1 l i+1 l k ) (m 1 m j-1 m j+1... m n )

63 Conversion to CNF B 1,1 (P 1,2 P 2,1 )β 1. Eliminate, replacing α β with (α β) (β α). 2. (B 1,1 (P 1,2 P 2,1 )) ((P 1,2 P 2,1 ) B 1,1 ) 2. Eliminate, replacing α β with α β. ( B 1,1 P 1,2 P 2,1 ) ( (P 1,2 P 2,1 ) B 1,1 ) 3. Move inwards using de Morgan's rules and doublenegation:

64 Resolution algorithm Proof by contradiction, i.e., show KB α unsatisfiable

65 Resolution example KB = (B 1,1 (P 1,2 P 2,1 )) B 1,1 α = P 1,2

66 Forward and backward chaining Horn Form (restricted) KB = conjunction of Horn clauses Horn clause = proposition symbol; or (conjunction of symbols) symbol E.g., C (B A) (C D B) Modus Ponens (for Horn Form): complete for Horn KBs α 1,,α n, α 1 α n β Can be used with forward chaining or backward chaining. These algorithms are very natural and run in linear time β

67 Forward chaining Idea: fire any rule whose premises are satisfied in the KB, add its conclusion to the KB, until query is found

68 Forward chaining algorithm Forward chaining is sound and complete for Horn KB

69 Forward chaining example

70 Forward chaining example

71 Forward chaining example

72 Forward chaining example

73 Forward chaining example

74 Forward chaining example

75 Forward chaining example

76 Forward chaining example

77 Proof of completeness FC derives every atomic sentence that is entailed by KB 1. FC reaches a fixed point where no new atomic sentences are derived Consider the final state as a model m, assigning true/false to symbols Every clause in the original KB is true in m 4. a 1 a k b 4. Hence m is a model of KB

78 Backward chaining Idea: work backwards from the query q: to prove q by BC, check if q is known already, or prove by BC all premises of some rule concluding q Avoid loops: check if new subgoal is already on the goal stack Avoid repeated work: check if new subgoal 1. has already been proved true, or

79 Backward chaining example

80 Backward chaining example

81 Backward chaining example

82 Backward chaining example

83 Backward chaining example

84 Backward chaining example

85 Backward chaining example

86 Backward chaining example

87 Backward chaining example

88 Backward chaining example

89 Forward vs. backward chaining FC is data-driven, automatic, unconscious processing, e.g., object recognition, routine decisions May do lots of work that is irrelevant to the goal BC is goal-driven, appropriate for problem-solving, e.g., Where are my keys? How do I get into a PhD program? Complexity of BC can be much less than linear in size of KB

90 Efficient propositional inference Two families of efficient algorithms for propositional inference: Complete backtracking search algorithms DPLL algorithm (Davis, Putnam, Logemann, Loveland) Incomplete local search algorithms WalkSAT algorithm

91 The DPLL algorithm Determine if an input propositional logic sentence (in CNF) is satisfiable. Improvements over truth table enumeration: 1. Early termination A clause is true if any literal is true. A sentence is false if any clause is false. 2. Pure symbol heuristic Pure symbol: always appears with the same "sign" in all clauses. e.g., In the three clauses (A B), ( B C), (C A), A and B are pure, C is impure. Make a pure symbol literal true. 3. Unit clause heuristic Unit clause: only one literal in the clause The only literal in a unit clause must be true.

92 The DPLL algorithm

93 The WalkSAT algorithm Incomplete, local search algorithm Evaluation function: The min-conflict heuristic of minimizing the number of unsatisfied clauses Balance between greediness and randomness

94 The WalkSAT algorithm

95 Hard satisfiability problems Consider random 3-CNF sentences. e.g., ( D B C) (B A C) ( C B E) (E D B) (B E C) m = number of clauses n = number of symbols

96 Hard satisfiability problems

97 Hard satisfiability problems Median runtime for 100 satisfiable random 3- CNF sentences, n = 50

98 Inference-based agents in the wumpus world A wumpus-world agent using propositional logic: P 1,1 W 1,1 B x,y (P x,y+1 P x,y-1 P x+1,y P x-1,y ) S x,y (W x,y+1 W x,y-1 W x+1,y W x-1,y ) W 1,1 W 1,2 W 4,4 W 1,1 W 1,2 W 1,1 W 1,3 64 distinct proposition symbols, 155 sentences

99

100 Expressiveness limitation of propositional logic KB contains "physics" sentences for every single square For every time t and every location [x,y], t t L x,y FacingRight t Forward t L x+1,y Rapid proliferation of clauses

101 Summary Logical agents apply inference to a knowledge base to derive new information and make decisions Basic concepts of logic: syntax: formal structure of sentences semantics: truth of sentences wrt models entailment: necessary truth of one sentence given another inference: deriving sentences from other sentences soundness: derivations produce only entailed sentences completeness: derivations can produce all entailed sentences Wumpus world requires the ability to represent partial and negated information, reason by cases, etc.

102 Inference in first-order logic

103 Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward chaining Backward chaining Resolution

104 Universal instantiation (UI) Every instantiation of a universally quantified sentence is entailed by it: v α Subst({v/g}, α) for any variable v and ground term g E.g., x King(x) Greedy(x) Evil(x) yields: King(John) Greedy(John) Evil(John) King(Richard) Greedy(Richard) Evil(Richard)

105 Existential instantiation (EI) For any sentence α, variable v, and constant symbol k that does not appear elsewhere in the knowledge base: v α Subst({v/k}, α) E.g., x Crown(x) OnHead(x,John) yields: Crown(C 1 ) OnHead(C 1,John) provided C 1 is a new constant symbol, called a Skolem constant

106 Reduction to propositional inference Suppose the KB contains just the following: x King(x) Greedy(x) Evil(x) King(John) Greedy(John) Brother(Richard,John) Instantiating the universal sentence in all possible ways, we have: King(John) Greedy(John) Evil(John) King(Richard) Greedy(Richard) Evil(Richard) King(John) Greedy(John) Brother(Richard,John) The new KB is propositionalized: proposition symbols are King(John), Greedy(John), Evil(John), King(Richard), etc.

107 Reduction contd. Every FOL KB can be propositionalized so as to preserve entailment (A ground sentence is entailed by new KB iff entailed by original KB) Idea: propositionalize KB and query, apply resolution, return result Problem: with function symbols, there are infinitely many ground terms,

108 Reduction contd. Theorem: Herbrand (1930). If a sentence α is entailed by an FOL KB, it is entailed by a finite subset of the propositionalized KB Idea: For n = 0 to do create a propositional KB by instantiating with depth-$n$ terms see if α is entailed by this KB Problem: works if α is entailed, loops if α is not entailed Theorem: Turing (1936), Church (1936) Entailment for FOL is semidecidable (algorithms exist that say yes to every entailed sentence, but no algorithm exists that also says no to every nonentailed sentence.)

109 Problems with propositionalization Propositionalization seems to generate lots of irrelevant sentences. E.g., from: x King(x) Greedy(x) Evil(x) King(John) y Greedy(y) Brother(Richard,John) it seems obvious that Evil(John), but propositionalization produces lots of facts such as Greedy(Richard) that are irrelevant With p k-ary predicates and n constants, there are p n k instantiations.

110 Unification We can get the inference immediately if we can find a substitution θ such that King(x) and Greedy(x) match King(John) and Greedy(y) θ = {x/john,y/john} works Unify(α,β) = θ if αθ = βθ p q θ Knows(John,x) Knows(John,Jane) Knows(John,x) Knows(y,OJ) Knows(John,x) Knows(y,Mother(y)) Knows(John,x) Knows(x,OJ)

111 Unification We can get the inference immediately if we can find a substitution θ such that King(x) and Greedy(x) match King(John) and Greedy(y) θ = {x/john,y/john} works Unify(α,β) = θ if αθ = βθ p q θ Knows(John,x) Knows(John,Jane) {x/jane}} Knows(John,x) Knows(y,OJ) Knows(John,x) Knows(y,Mother(y)) Knows(John,x) Knows(x,OJ)

112 Unification We can get the inference immediately if we can find a substitution θ such that King(x) and Greedy(x) match King(John) and Greedy(y) θ = {x/john,y/john} works Unify(α,β) = θ if αθ = βθ p q θ Knows(John,x) Knows(John,Jane) {x/jane}} Knows(John,x) Knows(y,OJ) {x/oj,y/john}} Knows(John,x) Knows(y,Mother(y)) Knows(John,x) Knows(x,OJ) Standardizing apart eliminates overlap of variables, e.g.,

113 Unification We can get the inference immediately if we can find a substitution θ such that King(x) and Greedy(x) match King(John) and Greedy(y) θ = {x/john,y/john} works Unify(α,β) = θ if αθ = βθ p q θ Knows(John,x) Knows(John,Jane) {x/jane}} Knows(John,x) Knows(y,OJ) {x/oj,y/john}} Knows(John,x) Knows(y,Mother(y)) {y/john,x/mother(john)}} Knows(John,x) Knows(x,OJ) Standardizing apart eliminates overlap of variables, e.g.,

114 Unification We can get the inference immediately if we can find a substitution θ such that King(x) and Greedy(x) match King(John) and Greedy(y) θ = {x/john,y/john} works Unify(α,β) = θ if αθ = βθ p q θ Knows(John,x) Knows(John,Jane) {x/jane}} Knows(John,x) Knows(y,OJ) {x/oj,y/john}} Knows(John,x) Knows(y,Mother(y)) {y/john,x/mother(john)}} Knows(John,x) Knows(x,OJ) {fail}

115 Unification To unify Knows(John,x) and Knows(y,z), θ = {y/john, x/z } or θ = {y/john, x/john, z/john} The first unifier is more general than the second. There is a single most general unifier (MGU) that is unique up to renaming of variables. MGU = { y/john, x/z }

116 The unification algorithm

117 The unification algorithm

118 Generalized Modus Ponens (GMP) p 1 ', p 2 ',, p n ', ( p 1 p 2 p n q) qθ p 1 ' is King(John) p 1 is King(x) p 2 ' is Greedy(y) p 2 is Greedy(x) θ is {x/john,y/john} q is Evil(x) q θ is Evil(John) where p i 'θ = p i θ for all i GMP used with KB of definite clauses (exactly one positive literal) All variables assumed universally quantified

119 Soundness of GMP Need to show that p 1 ',, p n ', (p 1 p n q) qθ provided that p i 'θ = p i θ for all I Lemma: For any sentence p, we have p pθ by UI 1. (p 1 p n q) (p 1 p n q)θ = (p 1 θ p n θ qθ) p 1 ', \;, \;p n ' p 1 ' p n ' p 1 'θ p n 'θ 3. From 1 and 2, qθ follows by ordinary Modus Ponens 4.

120 Example knowledge base The law says that it is a crime for an American to sell weapons to hostile nations. The country Nono, an enemy of America, has some missiles, and all of its missiles were sold to it by Colonel West, who is American. Prove that Col. West is a criminal

121 Example knowledge base contd.... it is a crime for an American to sell weapons to hostile nations: American(x) Weapon(y) Sells(x,y,z) Hostile(z) Criminal(x) Nono has some missiles, i.e., x Owns(Nono,x) Missile(x): Owns(Nono,M 1 ) and Missile(M 1 ) all of its missiles were sold to it by Colonel West Missile(x) Owns(Nono,x) Sells(West,x,Nono) Missiles are weapons: Missile(x) Weapon(x) An enemy of America counts as "hostile : Enemy(x,America) Hostile(x) West, who is American American(West) The country Nono, an enemy of America Enemy(Nono,America)

122 Forward chaining algorithm

123 Forward chaining proof

124 Forward chaining proof

125 Forward chaining proof

126 Properties of forward chaining Sound and complete for first-order definite clauses Datalog = first-order definite clauses + no functions FC terminates for Datalog in finite number of iterations May not terminate in general if α is not entailed This is unavoidable: entailment with definite clauses is semidecidable

127 Efficiency of forward chaining Incremental forward chaining: no need to match a rule on iteration k if a premise wasn't added on iteration k-1 match each rule whose premise contains a newly added positive literal Matching itself can be expensive: Database indexing allows O(1) retrieval of known facts e.g., query Missile(x) retrieves Missile(M 1 ) Forward chaining is widely used in deductive databases

128 Hard matching example Diff(wa,nt) Diff(wa,sa) Diff(nt,q) Diff(nt,sa) Diff(q,nsw) Diff(q,sa) Diff(nsw,v) Diff(nsw,sa) Diff(v,sa) Colorable() Diff(Red,Blue) Diff (Red,Green) Diff(Green,Red) Diff(Green,Blue) Diff(Blue,Red) Diff(Blue,Green) Colorable() is inferred iff the CSP has a solution CSPs include 3SAT as a special case, hence matching is NP-hard

129 Backward chaining algorithm SUBST(COMPOSE(θ 1, θ 2 ), p) = SUBST(θ 2, SUBST(θ 1, p))

130 Backward chaining example

131 Backward chaining example

132 Backward chaining example

133 Backward chaining example

134 Backward chaining example

135 Backward chaining example

136 Backward chaining example

137 Backward chaining example

138 Properties of backward chaining Depth-first recursive proof search: space is linear in size of proof Incomplete due to infinite loops fix by checking current goal against every goal on stack Inefficient due to repeated subgoals (both success and failure) fix using caching of previous results (extra space)

139 Logic programming: Prolog Algorithm = Logic + Control Basis: backward chaining with Horn clauses + bells & whistles Widely used in Europe, Japan (basis of 5th Generation project) Compilation techniques 60 million LIPS Program = set of clauses = head :- literal 1, literal n. criminal(x) :- american(x), weapon(y), sells(x,y,z), hostile(z). Depth-first, left-to-right backward chaining Built-in predicates for arithmetic etc., e.g., X is Y*Z+3 Built-in predicates that have side effects (e.g., input and output predicates, assert/retract predicates) Closed-world assumption ("negation as failure") e.g., given alive(x) :- not dead(x).

140 Prolog Appending two lists to produce a third: append([],y,y). append([x L],Y,[X Z]) :- append(l,y,z). query: append(a,b,[1,2])? answers: A=[] B=[1,2] A=[1] B=[2] A=[1,2] B=[]

141 Resolution: brief summary Full first-order version: l 1 l k, m 1 m n (l 1 l i-1 l i+1 l k m 1 m j-1 m j+1 m n )θ where Unify(l i, m j ) = θ. The two clauses are assumed to be standardized apart so that they share no variables. For example, Rich(x) Unhappy(x) Rich(Ken) Unhappy(Ken) with θ = {x/ken}

142 Conversion to CNF Everyone who loves all animals is loved by someone: x [ y Animal(y) Loves(x,y)] [ y Loves(y,x)] 1. Eliminate biconditionals and implications x [ y Animal(y) Loves(x,y)] [ y Loves(y,x)] 2. Move inwards: x p x p, x p x p x [ y ( Animal(y) Loves(x,y))] [ y Loves(y,x)]

143 Conversion to CNF contd. 3. Standardize variables: each quantifier should use a different one 4. x [ y Animal(y) Loves(x,y)] [ z Loves(z,x)] 4. Skolemize: a more general form of existential instantiation. Each existential variable is replaced by a Skolem function of the enclosing universally quantified variables: x [Animal(F(x)) Loves(x,F(x))] Loves(G(x),x) 5. Drop universal quantifiers: [Animal(F(x)) Loves(x,F(x))] Loves(G(x),x) 6. Distribute over :

144 Resolution proof: definite clauses

First-Order Logic. Chapter 8

First-Order Logic. Chapter 8 First-Order Logic Chapter 8 Outline Why FOL? Syntax and semantics of FOL Using FOL Wumpus world in FOL Knowledge engineering in FOL Pros and cons of propositional logic Propositional logic is declarative

More information

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS Lecture 13, 5/18/2005 University of Washington, Department of Electrical Engineering Spring 2005 Instructor: Professor Jeff A. Bilmes Inference in first-order

More information

First-Order Logic. Chapter 8

First-Order Logic. Chapter 8 First-Order Logic Chapter 8 1 Outline Why FOL? Syntax and semantics of FOL Using FOL Wumpus world in FOL Knowledge engineering in FOL 2 Pros and cons of propositional logic Propositional logic is declarative

More information

Set 8: Inference in First-order logic. ICS 271 Fall 2013 Chapter 9: Russell and Norvig

Set 8: Inference in First-order logic. ICS 271 Fall 2013 Chapter 9: Russell and Norvig Set 8: Inference in First-order logic ICS 271 Fall 2013 Chapter 9: Russell and Norvig Universal instantiation (UI) Every instantiation of a universally quantified sentence is entailed by it: v α Subst({v/g},

More information

Outline. Reducing first-order inference to propositional inference Unification. Forward chaining Backward chaining

Outline. Reducing first-order inference to propositional inference Unification. Forward chaining Backward chaining Inference in First-Order Od Logic 1 Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward chaining Backward chaining Resolution 2 Universal instantiation

More information

Set 8: Inference in First-order logic. ICS 271 Fall 2017 Chapter 9: Russell and Norvig

Set 8: Inference in First-order logic. ICS 271 Fall 2017 Chapter 9: Russell and Norvig Set 8: Inference in First-order logic ICS 271 Fall 2017 Chapter 9: Russell and Norvig Universal instantiation (UI) Every instantiation of a universally quantified sentence is entailed by it: v α Subst({v/g},

More information

Outline. First-order logic. Atomic sentences. Intelligent Systems and HCI D7023E. Syntax of FOL: Basic elements. Pros and cons of propositional logic

Outline. First-order logic. Atomic sentences. Intelligent Systems and HCI D7023E. Syntax of FOL: Basic elements. Pros and cons of propositional logic Outline Intelligent Systems and HCI D7023E Lecture 8: First-order Logic [Ch.8] Paweł Pietrzak Why FOL? Syntax and semantics of FOL Using FOL Knowledge engineering in FOL Some inference in FOL 1 Pros and

More information

CS 771 Artificial Intelligence. First Order Logic Inference

CS 771 Artificial Intelligence. First Order Logic Inference CS 771 Artificial Intelligence First Order Logic Inference Universal instantiation (UI) Notation: Subst({v/g}, α) means the result of substituting ground term g for variable v in sentence α Every instantiation

More information

CS 188: Artificial Intelligence Spring 2007

CS 188: Artificial Intelligence Spring 2007 CS 188: Artificial Intelligence Spring 2007 Lecture 9: Logical Agents 2 2/13/2007 Srini Narayanan ICSI and UC Berkeley Many slides over the course adapted from Dan Klein, Stuart Russell or Andrew Moore

More information

First-Order Logic. Chapter 8

First-Order Logic. Chapter 8 First-Order Logic Chapter 8 Outline Why FOL? Syntax and semantics of FOL Using FOL Wumpus world in FOL Knowledge engineering in FOL Pros/cons of propositional logic Propositional logic is declarative (recall

More information

Introduction to Artificial Intelligence 2 nd semester 2016/2017. Chapter 9: Inference in First-Order Logic

Introduction to Artificial Intelligence 2 nd semester 2016/2017. Chapter 9: Inference in First-Order Logic Introduction to Artificial Intelligence 2 nd semester 2016/2017 Chapter 9: Inference in First-Order Logic Mohamed B. Abubaker Palestine Technical College Deir El-Balah 1 Outlines Reducing first-order inference

More information

Outline. Inference in first- order logic: just a taste. Universal instan8a8on (UI) Inference with Quan8fiers. Reduc8on to proposi8onal inference

Outline. Inference in first- order logic: just a taste. Universal instan8a8on (UI) Inference with Quan8fiers. Reduc8on to proposi8onal inference Outline Inference in first- order logic: just a taste Dr. Melanie Mar8n CS 4480 Based on slides from hap://aima.eecs.berkeley.edu/2nd- ed/slides- ppt/ Reducing first- order inference to proposi8onal inference

More information

Logical Agents. Chapter 7

Logical Agents. Chapter 7 Logical Agents Chapter 7 Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem

More information

First-Order Logic. Michael Rovatsos. University of Edinburgh R&N: February Informatics 2D

First-Order Logic. Michael Rovatsos. University of Edinburgh R&N: February Informatics 2D First-Order Logic R&N: 8.1-8.3 Michael Rovatsos University of Edinburgh 4 February 2016 Outline Why FOL? Syntax and semantics of FOL Using FOL Wumpus world in FOL Pros and cons of propositional logic Propositional

More information

First-Order Logic. Peter Antal

First-Order Logic. Peter Antal First-Order Logic Peter Antal antal@mit.bme.hu 10/16/2015 1 Why FOL? Syntax and semantics of FOL Knowledge engineering in FOL Inference in FOL Reducing first-order inference to propositional inference

More information

Intelligent Agents. Pınar Yolum Utrecht University

Intelligent Agents. Pınar Yolum Utrecht University Intelligent Agents Pınar Yolum p.yolum@uu.nl Utrecht University Logical Agents (Based mostly on the course slides from http://aima.cs.berkeley.edu/) Outline Knowledge-based agents Wumpus world Logic in

More information

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS Lecture 10, 5/9/2005 University of Washington, Department of Electrical Engineering Spring 2005 Instructor: Professor Jeff A. Bilmes Logical Agents Chapter 7

More information

Deliberative Agents Knowledge Representation II. First Order Predicate Logic

Deliberative Agents Knowledge Representation II. First Order Predicate Logic Deliberative Agents Knowledge Representation II Vasant Honavar Bioinformatics and Computational Biology Program Center for Computational Intelligence, Learning, & Discovery honavar@cs.iastate.edu www.cs.iastate.edu/~honavar/

More information

CS 561: Artificial Intelligence

CS 561: Artificial Intelligence CS 561: Artificial Intelligence Instructor: TAs: Sofus A. Macskassy, macskass@usc.edu Nadeesha Ranashinghe (nadeeshr@usc.edu) William Yeoh (wyeoh@usc.edu) Harris Chiu (chiciu@usc.edu) Lectures: MW 5:00-6:20pm,

More information

Inf2D 11: Unification and Generalised Modus Ponens

Inf2D 11: Unification and Generalised Modus Ponens Inf2D 11: Unification and Generalised Modus Ponens School of Informatics, University of Edinburgh 08/02/18 Slide Credits: Jacques Fleuriot, Michael Rovatsos, Michael Herrmann Outline Reducing first-order

More information

Inference in First-Order Logic

Inference in First-Order Logic A brief history of reasoning 450B.C. Stoics propositional logic, inference (maybe) 322B.C. Aristotle syllogisms (inference rules), quantifi 1565 Cardano probability theory (propositional logic + uncertainty)

More information

First-Order Logic. CS367 ARTIFICIAL INTELLIGENCE Chapter 8

First-Order Logic. CS367 ARTIFICIAL INTELLIGENCE Chapter 8 First-Order Logic CS367 ARTIFICIAL INTELLIGENCE Chapter 8 2012 Semester 2 Patricia J Riddle Adapted from slides by Stuart Russell, http://aima.cs.berkeley.edu/instructors.html 1 Outline Why FOL? Syntax

More information

Inference in first-order logic

Inference in first-order logic Revised by Hankui Zhuo, March 28, 2018 Inference in first-order logic Chapter 9 Chapter 9 1 Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward

More information

CS 5100: Founda.ons of Ar.ficial Intelligence

CS 5100: Founda.ons of Ar.ficial Intelligence CS 5100: Founda.ons of Ar.ficial Intelligence Logical Inference Prof. Amy Sliva September 29, 2011 Outline First- order logic Review syntax and semantics Conjunctive normal form Inference in FOL Theoretical

More information

Inference in first-order logic

Inference in first-order logic Inference in first-order logic Chapter 9 Chapter 9 1 Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward and backward chaining Logic programming

More information

Inference in first-order logic

Inference in first-order logic Inference in first-order logic Chapter 9 Chapter 9 1 Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward and backward chaining Resolution Chapter

More information

Chapter 7 R&N ICS 271 Fall 2017 Kalev Kask

Chapter 7 R&N ICS 271 Fall 2017 Kalev Kask Set 6: Knowledge Representation: The Propositional Calculus Chapter 7 R&N ICS 271 Fall 2017 Kalev Kask Outline Representing knowledge using logic Agent that reason logically A knowledge based agent Representing

More information

Logical Agents. Outline

Logical Agents. Outline Logical Agents *(Chapter 7 (Russel & Norvig, 2004)) Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability

More information

Inference in first-order logic

Inference in first-order logic Inference in first-order logic Chapter 9 Chapter 9 1 Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward and backward chaining Logic programming

More information

First Order Logic. CS171, Fall 2016 Introduc;on to Ar;ficial Intelligence Prof. Alexander Ihler

First Order Logic. CS171, Fall 2016 Introduc;on to Ar;ficial Intelligence Prof. Alexander Ihler First Order Logic CS171, Fall 2016 Introduc;on to Ar;ficial Intelligence Prof. Alexander Ihler Outline New ontology objects, rela;ons, proper;es, func;ons. New Syntax Constants, predicates, proper;es,

More information

Chapter 8 First Order Logic

Chapter 8 First Order Logic 1 Chapter 8 First Order Logic BBM 405 Artificial Intelligence Pinar Duygulu Slides are mostly adapted from AIMA and MIT Open Courseware CS461 Artificial Intelligence Pinar Spring Pros and cons of propositional

More information

Logical agents. Chapter 7. Chapter 7 1

Logical agents. Chapter 7. Chapter 7 1 Logical agents Chapter 7 Chapter 7 Outline Knowledge-based agents Wumpus world Logic in general models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules

More information

Inference in first-order logic

Inference in first-order logic Inference in first-order logic Chapter 9 Chapter 9 1 Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward and backward chaining Logic programming

More information

TDT4136 Logic and Reasoning Systems

TDT4136 Logic and Reasoning Systems TDT436 Logic and Reasoning Systems Chapter 7 - Logic gents Lester Solbakken solbakke@idi.ntnu.no Norwegian University of Science and Technology 06.09.0 Lester Solbakken TDT436 Logic and Reasoning Systems

More information

J Propositional logic is declarative J Propositional logic is compositional: q meaning of B 1,1 P 1,2 is derived from meaning of B 1,1 and of P 1,2

J Propositional logic is declarative J Propositional logic is compositional: q meaning of B 1,1 P 1,2 is derived from meaning of B 1,1 and of P 1,2 Propositional logic First-Order Logic Russell and Norvig Chapter 8 J Propositional logic is declarative J Propositional logic is compositional: meaning of B 1,1 P 1,2 is derived from meaning of B 1,1 and

More information

Logical Agents. Chapter 7

Logical Agents. Chapter 7 Logical Agents Chapter 7 Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem

More information

First-Order Logic. Propositional logic. First Order logic. First Order Logic. Logics in General. Syntax of FOL. Examples of things we can say:

First-Order Logic. Propositional logic. First Order logic. First Order Logic. Logics in General. Syntax of FOL. Examples of things we can say: Propositional logic First-Order Logic Russell and Norvig Chapter 8 Propositional logic is declarative Propositional logic is compositional: meaning of B 1,1 P 1,2 is derived from meaning of B 1,1 and of

More information

7. Logical Agents. COMP9414/ 9814/ 3411: Artificial Intelligence. Outline. Knowledge base. Models and Planning. Russell & Norvig, Chapter 7.

7. Logical Agents. COMP9414/ 9814/ 3411: Artificial Intelligence. Outline. Knowledge base. Models and Planning. Russell & Norvig, Chapter 7. COMP944/984/34 6s Logic COMP944/ 984/ 34: rtificial Intelligence 7. Logical gents Outline Knowledge-based agents Wumpus world Russell & Norvig, Chapter 7. Logic in general models and entailment Propositional

More information

Knowledge Representation using First-Order Logic (Part III)

Knowledge Representation using First-Order Logic (Part III) Knowledge Representation using First-Order Logic (Part III) This lecture: R&N Chapters 8, 9 Next lecture: Chapter 13; Chapter 14.1-14.2 (Please read lecture topic material before and after each lecture

More information

Inference in first-order logic

Inference in first-order logic Inference in first-order logic Chapter 9 Chapter 9 1 Ch. 9 Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward and backward chaining Resolution

More information

Artificial Intelligence Chapter 7: Logical Agents

Artificial Intelligence Chapter 7: Logical Agents Artificial Intelligence Chapter 7: Logical Agents Michael Scherger Department of Computer Science Kent State University February 20, 2006 AI: Chapter 7: Logical Agents 1 Contents Knowledge Based Agents

More information

Inf2D 06: Logical Agents: Knowledge Bases and the Wumpus World

Inf2D 06: Logical Agents: Knowledge Bases and the Wumpus World Inf2D 06: Logical Agents: Knowledge Bases and the Wumpus World School of Informatics, University of Edinburgh 26/01/18 Slide Credits: Jacques Fleuriot, Michael Rovatsos, Michael Herrmann Outline Knowledge-based

More information

CSC242: Intro to AI. Lecture 13. Thursday, February 28, 13

CSC242: Intro to AI. Lecture 13. Thursday, February 28, 13 CSC242: Intro to AI Lecture 13 Recap Rooms adjacent to pits will have breezes Socrates is a person All people are mortal Anybody s grandmother is either their mother s or their father s mother Elements

More information

Class Assignment Strategies

Class Assignment Strategies Class Assignment Strategies ì Team- A'ack: Team a'ack ì Individualis2c: Search for possible ì Poli2cal: look at others and make decision based on who is winning, who is loosing, and conversa;on ì Emo2on

More information

CS 380: ARTIFICIAL INTELLIGENCE PREDICATE LOGICS. Santiago Ontañón

CS 380: ARTIFICIAL INTELLIGENCE PREDICATE LOGICS. Santiago Ontañón CS 380: RTIFICIL INTELLIGENCE PREDICTE LOGICS Santiago Ontañón so367@drexeledu Summary of last day: Logical gents: The can reason from the knowledge they have They can make deductions from their perceptions,

More information

Inference in first-order logic

Inference in first-order logic Inference in first-order logic CE417: Introduction to Artificial Intelligence Sharif University of Technology Spring 2014 Soleymani Artificial Intelligence: A Modern Approach, 3 rd Edition, Chapter 9 Outline

More information

Inference in first-order logic

Inference in first-order logic Inference in first-order logic Chapter 9 Chapter 9 1 Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward and backward chaining Logic programming

More information

Artificial Intelligence

Artificial Intelligence Artificial Intelligence First-Order Logic Marc Toussaint University of Stuttgart Winter 2015/16 (slides based on Stuart Russell s AI course) First-order logic (FOL) is exactly what is sometimes been thought

More information

Artificial Intelligence

Artificial Intelligence Artificial Intelligence Propositional Logic Marc Toussaint University of Stuttgart Winter 2015/16 (slides based on Stuart Russell s AI course) Outline Knowledge-based agents Wumpus world Logic in general

More information

From Propositional Logic to First-Order Logic. Peter Antal

From Propositional Logic to First-Order Logic. Peter Antal From Propositional Logic to First-Order Logic Peter Antal antal@mit.bme.hu 3/7/2018 1 Why FOL? Syntax and semantics of FOL Knowledge engineering in FOL Inference in FOL Reducing first-order inference to

More information

Revised by Hankui Zhuo, March 21, Logical agents. Chapter 7. Chapter 7 1

Revised by Hankui Zhuo, March 21, Logical agents. Chapter 7. Chapter 7 1 Revised by Hankui Zhuo, March, 08 Logical agents Chapter 7 Chapter 7 Outline Wumpus world Logic in general models and entailment Propositional (oolean) logic Equivalence, validity, satisfiability Inference

More information

First-Order Logic Chap8 1. Pros and Cons of Prop. Logic

First-Order Logic Chap8 1. Pros and Cons of Prop. Logic Chapter8 First-Order Logic 20070503 Chap8 1 Pros and Cons of Prop. Logic PL is declarative Knowledge and inference are separate and inference is entirely domain-independent. PL is compositional Meaning

More information

Logic. proof and truth syntacs and semantics. Peter Antal

Logic. proof and truth syntacs and semantics. Peter Antal Logic proof and truth syntacs and semantics Peter Antal antal@mit.bme.hu 10/9/2015 1 Knowledge-based agents Wumpus world Logic in general Syntacs transformational grammars Semantics Truth, meaning, models

More information

CS 771 Artificial Intelligence. Propositional Logic

CS 771 Artificial Intelligence. Propositional Logic CS 771 Artificial Intelligence Propositional Logic Why Do We Need Logic? Problem-solving agents were very inflexible hard code every possible state E.g., in the transition of 8-puzzle problem, knowledge

More information

CS 188: Artificial Intelligence Spring 2007

CS 188: Artificial Intelligence Spring 2007 CS 188: Artificial Intelligence Spring 2007 Lecture 8: Logical Agents - I 2/8/2007 Srini Narayanan ICSI and UC Berkeley Many slides over the course adapted from Dan Klein, Stuart Russell or Andrew Moore

More information

CS 380: ARTIFICIAL INTELLIGENCE

CS 380: ARTIFICIAL INTELLIGENCE CS 380: RTIFICIL INTELLIGENCE PREDICTE LOGICS 11/8/2013 Santiago Ontañón santi@cs.drexel.edu https://www.cs.drexel.edu/~santi/teaching/2013/cs380/intro.html Summary of last day: Logical gents: The can

More information

Logical Agent & Propositional Logic

Logical Agent & Propositional Logic Logical Agent & Propositional Logic Berlin Chen 2005 References: 1. S. Russell and P. Norvig. Artificial Intelligence: A Modern Approach. Chapter 7 2. S. Russell s teaching materials Introduction The representation

More information

First Order Logic (FOL) and Inference

First Order Logic (FOL) and Inference First Order Logic (FOL) and Inference CE417: Introduction to Artificial Intelligence Sharif University of Technology Spring 2018 Soleymani Artificial Intelligence: A Modern Approach, 3 rd Edition, Chapter

More information

Logical agents. Chapter 7. Chapter 7 1

Logical agents. Chapter 7. Chapter 7 1 Logical agents Chapter 7 Chapter 7 1 Outline Knowledge-based agents Logic in general models and entailment Propositional (oolean) logic Equivalence, validity, satisfiability Inference rules and theorem

More information

Inference in First-Order Predicate Calculus

Inference in First-Order Predicate Calculus Inference in First-Order Predicate Calculus Deepak Kumar November 2017 Knowledge Engineering in FOPC Identify the task Assemble relevant knowledge Decide on a vocabulary of predicates, functions, and constants

More information

Outline. Logic. Knowledge bases. Wumpus world characteriza/on. Wumpus World PEAS descrip/on. A simple knowledge- based agent

Outline. Logic. Knowledge bases. Wumpus world characteriza/on. Wumpus World PEAS descrip/on. A simple knowledge- based agent Outline Logic Dr. Melanie Mar/n CS 4480 October 8, 2012 Based on slides from hap://aima.eecs.berkeley.edu/2nd- ed/slides- ppt/ Knowledge- based agents Wumpus world Logic in general - models and entailment

More information

Introduction to Artificial Intelligence. Logical Agents

Introduction to Artificial Intelligence. Logical Agents Introduction to Artificial Intelligence Logical Agents (Logic, Deduction, Knowledge Representation) Bernhard Beckert UNIVERSITÄT KOBLENZ-LANDAU Winter Term 2004/2005 B. Beckert: KI für IM p.1 Outline Knowledge-based

More information

Logical Agents: Propositional Logic. Chapter 7

Logical Agents: Propositional Logic. Chapter 7 Logical Agents: Propositional Logic Chapter 7 Outline Topics: Knowledge-based agents Example domain: The Wumpus World Logic in general models and entailment Propositional (Boolean) logic Equivalence, validity,

More information

Artificial Intelligence

Artificial Intelligence Artificial Intelligence Propositional Logic Marc Toussaint University of Stuttgart Winter 2016/17 (slides based on Stuart Russell s AI course) Motivation: Most students will have learnt about propositional

More information

Advanced Artificial Intelligence (SCOM7341) First Order Logic. Dr. Mustafa Jarrar

Advanced Artificial Intelligence (SCOM7341) First Order Logic. Dr. Mustafa Jarrar Lecture Notes, Advanced Artificial Intelligence (SCOM7341) Sina Institute, University of Birzeit 2 nd Semester, 2012 Advanced Artificial Intelligence (SCOM7341) First Order Logic Dr. Mustafa Jarrar Sina

More information

Proof Methods for Propositional Logic

Proof Methods for Propositional Logic Proof Methods for Propositional Logic Logical equivalence Two sentences are logically equivalent iff they are true in the same models: α ß iff α β and β α Russell and Norvig Chapter 7 CS440 Fall 2015 1

More information

First Order Logic (FOL)

First Order Logic (FOL) First Order Logic (FOL) CE417: Introduction to Artificial Intelligence Sharif University of Technology Spring 2015 Soleymani Artificial Intelligence: A Modern Approach, 3 rd Edition, Chapter 8 Why FOL?

More information

Logical Agent & Propositional Logic

Logical Agent & Propositional Logic Logical Agent & Propositional Logic Berlin Chen Department of Computer Science & Information Engineering National Taiwan Normal University References: 1. S. Russell and P. Norvig. Artificial Intelligence:

More information

Logical Agents. Outline

Logical Agents. Outline ogical gents Chapter 6, Ie Chapter 7 Outline Knowledge-based agents Wumpus world ogic in general models and entailment ropositional (oolean) logic Equivalence, validity, satisfiability Inference rules

More information

Kecerdasan Buatan M. Ali Fauzi

Kecerdasan Buatan M. Ali Fauzi Kecerdasan Buatan M. Ali Fauzi Artificial Intelligence M. Ali Fauzi Logical Agents M. Ali Fauzi In which we design agents that can form representations of the would, use a process of inference to derive

More information

Title: Logical Agents AIMA: Chapter 7 (Sections 7.4 and 7.5)

Title: Logical Agents AIMA: Chapter 7 (Sections 7.4 and 7.5) B.Y. Choueiry 1 Instructor s notes #12 Title: Logical Agents AIMA: Chapter 7 (Sections 7.4 and 7.5) Introduction to Artificial Intelligence CSCE 476-876, Fall 2018 URL: www.cse.unl.edu/ choueiry/f18-476-876

More information

Last update: March 4, Logical agents. CMSC 421: Chapter 7. CMSC 421: Chapter 7 1

Last update: March 4, Logical agents. CMSC 421: Chapter 7. CMSC 421: Chapter 7 1 Last update: March 4, 00 Logical agents CMSC 4: Chapter 7 CMSC 4: Chapter 7 Outline Knowledge-based agents Wumpus world Logic in general models and entailment Propositional (oolean) logic Equivalence,

More information

Chương 3 Tri th ức và lập luận

Chương 3 Tri th ức và lập luận Chương 3 Tri thức và lập luận Nội dung chính chương 3 Lecture 1 Lecture 2 Lecture 3,4 I. Logic ngôn ngữ của tư duy II. Logic mệnh đề (cú pháp, ngữ nghĩa, sức mạnh biểu diễn, các thuật toán suy diễn) III.

More information

Propositional Logic: Methods of Proof. Chapter 7, Part II

Propositional Logic: Methods of Proof. Chapter 7, Part II Propositional Logic: Methods of Proof Chapter 7, Part II Inference in Formal Symbol Systems: Ontology, Representation, ti Inference Formal Symbol Systems Symbols correspond to things/ideas in the world

More information

Lecture 6: Knowledge 1

Lecture 6: Knowledge 1 rtificial Intelligence, CS, Nanjing University Spring, 08, Yang Yu Lecture 6: Knowledge http://cs.nju.edu.cn/yuy/course_ai8.ash Previously... Basic ability: search Path-based search Iterative-improvement

More information

Propositional Logic: Methods of Proof (Part II)

Propositional Logic: Methods of Proof (Part II) Propositional Logic: Methods of Proof (Part II) This lecture topic: Propositional Logic (two lectures) Chapter 7.1-7.4 (previous lecture, Part I) Chapter 7.5 (this lecture, Part II) (optional: 7.6-7.8)

More information

Logical Agents. Knowledge based agents. Knowledge based agents. Knowledge based agents. The Wumpus World. Knowledge Bases 10/20/14

Logical Agents. Knowledge based agents. Knowledge based agents. Knowledge based agents. The Wumpus World. Knowledge Bases 10/20/14 0/0/4 Knowledge based agents Logical Agents Agents need to be able to: Store information about their environment Update and reason about that information Russell and Norvig, chapter 7 Knowledge based agents

More information

(Part II) Reading: R&N Chapters 8, 9

(Part II) Reading: R&N Chapters 8, 9 Knowledge Representation using First-Order Logic (Part II) Reading: R&N Chapters 8, 9 Outline Review: KB = S is equivalent to = (KB S) So what does {} = S mean? Review: Follows, Entails, Derives Follows:

More information

Knowledge base (KB) = set of sentences in a formal language Declarative approach to building an agent (or other system):

Knowledge base (KB) = set of sentences in a formal language Declarative approach to building an agent (or other system): Logic Knowledge-based agents Inference engine Knowledge base Domain-independent algorithms Domain-specific content Knowledge base (KB) = set of sentences in a formal language Declarative approach to building

More information

Logical Agents. CITS3001 Algorithms, Agents and Artificial Intelligence. 2018, Semester 2

Logical Agents. CITS3001 Algorithms, Agents and Artificial Intelligence. 2018, Semester 2 Logical Agents CITS3001 Algorithms, Agents and Artificial Intelligence Tim French School of Computer Science and Software Engineering The University of Western Australia 2018, Semester 2 Summary We motivate

More information

First Order Logic (FOL)

First Order Logic (FOL) First Order Logic (FOL) CE417: Introduction to Artificial Intelligence Sharif University of Technology Spring 2013 Soleymani Course material: Artificial Intelligence: A Modern Approach, 3 rd Edition, Chapter

More information

Artificial Intelligence Chapter 9: Inference in First-Order Logic

Artificial Intelligence Chapter 9: Inference in First-Order Logic Artificial Intelligence Chapter 9: Inference in First-Order Logic Andreas Zell After the Textbook: Artificial Intelligence, A Modern Approach by Stuart Russell and Peter Norvig (3 rd Edition) 9 Inference

More information

Lecture 7: Logical Agents and Propositional Logic

Lecture 7: Logical Agents and Propositional Logic Lecture 7: Logical Agents and Propositional Logic CS 580 (001) - Spring 2018 Amarda Shehu Department of Computer Science George Mason University, Fairfax, VA, USA March 07, 2018 Amarda Shehu (580) 1 1

More information

Propositional Logic: Methods of Proof (Part II)

Propositional Logic: Methods of Proof (Part II) Propositional Logic: Methods of Proof (Part II) You will be expected to know Basic definitions Inference, derive, sound, complete Conjunctive Normal Form (CNF) Convert a Boolean formula to CNF Do a short

More information

Deliberative Agents Knowledge Representation I. Deliberative Agents

Deliberative Agents Knowledge Representation I. Deliberative Agents Deliberative Agents Knowledge Representation I Vasant Honavar Bioinformatics and Computational Biology Program Center for Computational Intelligence, Learning, & Discovery honavar@cs.iastate.edu www.cs.iastate.edu/~honavar/

More information

First-order logic. Chapter 8. Chapter 8 1

First-order logic. Chapter 8. Chapter 8 1 First-order logic Chapter 8 Chapter 8 1 (Slides borrowed from Stuart Russel: http://aima.eecs.berkeley.edu/slides-tex/) Chapter 8 2 First-order logic Whereas propositional logic assumes world contains

More information

Reasoning. Inference. Knowledge Representation 4/6/2018. User

Reasoning. Inference. Knowledge Representation 4/6/2018. User Reasoning Robotics First-order logic Chapter 8-Russel Representation and Reasoning In order to determine appropriate actions to take, an intelligent system needs to represent information about the world

More information

First-order logic. Chapter 8. Chapter 8 1

First-order logic. Chapter 8. Chapter 8 1 First-order logic Chapter 8 Chapter 8 1 Outline Why FOL? Syntax and semantics of FOL Fun with sentences Wumpus world in FOL Chapter 8 2 Pros and cons of propositional logic Propositional logic is declarative:

More information

Propositional Logic: Logical Agents (Part I)

Propositional Logic: Logical Agents (Part I) Propositional Logic: Logical Agents (Part I) This lecture topic: Propositional Logic (two lectures) Chapter 7.1-7.4 (this lecture, Part I) Chapter 7.5 (next lecture, Part II) Next lecture topic: First-order

More information

First order logic (FOL) Chapters 8 & 9

First order logic (FOL) Chapters 8 & 9 First order logic (FOL) Chapters 8 & 9 Pros and cons of propositional logic Propositional logic is declarative Propositional logic is compositional Meaning in propositional logic is context-independent

More information

A simple knowledge-based agent. Logical agents. Outline. Wumpus World PEAS description. Wumpus world characterization. Knowledge bases.

A simple knowledge-based agent. Logical agents. Outline. Wumpus World PEAS description. Wumpus world characterization. Knowledge bases. simple knowledge-based agent ogical agents Chapter 7 function K-gent( percept) returns an action static: K, a knowledge base t, a counter, initially, indicating time Tell(K, ake-ercept-entence( percept,

More information

First-Order Logic and Inference

First-Order Logic and Inference First-Order Logic and Inference Berlin Chen Department of Computer Science & Information Engineering National Taiwan Normal University References: 1. S. Russell and P. Norvig. Artificial Intelligence:

More information

Logical Inference. Artificial Intelligence. Topic 12. Reading: Russell and Norvig, Chapter 7, Section 5

Logical Inference. Artificial Intelligence. Topic 12. Reading: Russell and Norvig, Chapter 7, Section 5 rtificial Intelligence Topic 12 Logical Inference Reading: Russell and Norvig, Chapter 7, Section 5 c Cara MacNish. Includes material c S. Russell & P. Norvig 1995,2003 with permission. CITS4211 Logical

More information

First-order logic. First-order logic. Logics in general. Outline. Syntax of FOL: Basic elements. Pros and cons of propositional logic

First-order logic. First-order logic. Logics in general. Outline. Syntax of FOL: Basic elements. Pros and cons of propositional logic First-order logic Whereas propositional logic assumes world contains facts, first-order logic (like natural language) assumes the world contains First-order logic Chapter 8 Objects: people, houses, numbers,

More information

Inference in First-Order Logic

Inference in First-Order Logic Inference in First-Order Logic Dr. Richard J. Povinelli rev 1.0, 10/7/2001 Page 1 Objectives You should! be able to analyze and employ logical inference in first-order logic. rev 1.0, 10/7/2001 Page 2

More information

7.5.2 Proof by Resolution

7.5.2 Proof by Resolution 137 7.5.2 Proof by Resolution The inference rules covered so far are sound Combined with any complete search algorithm they also constitute a complete inference algorithm However, removing any one inference

More information

ARTIFICIAL INTELLIGENCE

ARTIFICIAL INTELLIGENCE Page1 ARTIFICIAL INTELLIGENCE UNIT-II LOGICAL REASONING Logical Agents propositional logic inferences first-order logic inferences in first-order logic forward chaining- backward chaining unification resolution

More information

Outline First-order logic. First-order Logic. Introduction. Recall: 4-Queens problem. First-order Logic. First-order Logic Syntax.

Outline First-order logic. First-order Logic. Introduction. Recall: 4-Queens problem. First-order Logic. First-order Logic Syntax. First-order Logic CS 486/686 Sept 25, 2008 University of Waterloo Outline First-order logic Syntax and semantics Inference Propositionalization with ground inference Lifted resolution 1 2 Introduction

More information

Rational Agents. Paolo Turrini. Introduction to Artificial Intelligence 2nd Part. Department of Computing, Imperial College London

Rational Agents. Paolo Turrini. Introduction to Artificial Intelligence 2nd Part. Department of Computing, Imperial College London Rational Agents Department of Computing, Imperial College London Introduction to Artificial Intelligence 2nd Part What you have seen You have seen procedures for computational problem-solving: searching

More information

CS 771 Artificial Intelligence. First order Logic

CS 771 Artificial Intelligence. First order Logic CS 771 Artificial Intelligence First order Logic Pros and cons of propositional logic Propositional logic is declarative - Knowledge and inference are separate - Inference is domain independent Propositional

More information