Presentation is loading. Please wait.

Presentation is loading. Please wait.

Announcements Midterm is Wednesday March 20, 7pm-9pm 

Similar presentations


Presentation on theme: "Announcements Midterm is Wednesday March 20, 7pm-9pm "— Presentation transcript:

1

2 Announcements Midterm is Wednesday March 20, 7pm-9pm 
Details on midterm prep page (follow link on piazza) Format: directly on the exam sheet (no blue books); closed book, no notes Location: multiple rooms, go to the right one Past exams: on prep page Review sessions in section next week and the week after

3 Reminder: Satisfiablity
A sentence is satisfiable if it is true in some world Efficient SAT solvers operate on CNF representation (easy to convert any PL sentence into CNF) (A  B)  (A  C) is satisfied by {A=true,B=*,C=*} (A  B)  ( A  C)  ( C   A)  ( C   B)  (A   B  C) unsatisfiable

4 Planning as satisfiability
For the fully observable, deterministic case: planning problem is solvable iff there is some satisfying assignment solution obtained from truth values of action variables For T = 1 to infinity, set up the KB as follows and run SAT solver: Initial state, domain constraints Transition model sentences up to time T Goal is true at time T

5 Pacman variables Pacman’s location
At_1,1_0 (Pacman is at [1,1] at time 0) At_3,3_4 etc Wall locations (these do not change with time) Wall_0,0 Wall_0,1 etc Ghosts (predictable movement) BGhost_2,2_0, etc. Food Food_2,1_0, etc. Life Alive_0 Actions W_0 (Pacman moves West at time 0), E_0 etc.

6 Initial state, domain constraints
Pacman may know its initial location: At_1,1_0 Domain constraints: general knowledge (W_0  E_0)  (W_0  S_0)  … (W_1  E_1)  (W_1  S_1)  … …  (W_0 v E_0 v N_0 v S_0)  … Domain constraints: map (or not) Wall_0,0   Wall_1,1  …  At_1,2_0  At_1,3_0 ….

7 Transition model A state variable gets its value according to a successor-state axiom Xt  [Xt-1  (some actiont-1 made it false)] v [Xt-1  (some actiont-1 made it true)] For food: Food_3,3_17  [Food_3,3_16  At_3,3_17] Alive at t iff Alive at t-1 and no ghost on same square as Pacman Alive_7  [Alive_6  (At_1,1_6  (Bghost_1,1_6 v Cghost_1,1_6 V …))  (At_1,2_6  (Bghost_1,2_6 v Cghost_1,2_6 V …))  (At_1,3_6  (Bghost_1,3_6 v Cghost_1,3_6 V …))

8 Transition model contd.
For Pacman location: At_3,3_17  [At_3,3_16  ((Wall_3,4  N_16) v (Wall_4,3  E_16) v …)] v [At_3,3_16  ((At_3,2_16  Wall_3,3  N_16) v (At_2,3_16  Wall_3,3  N_16) v …)]

9 Goal Still alive and no food anywhere at time T
Alive _T  Food_1,1_T  Food_1,2_T …

10 Summary One possible agent architecture: knowledge + inference
Logics provide a formal way to encode knowledge A logic is defined by: syntax, set of possible worlds, truth condition Logical inference computes entailment relations among sentences SAT solvers based on DPLL provide incredibly efficient inference Logical agents can construct plans by asking whether there is a future in which the goal is achieved Propositional logic is insufficiently expressive for general knowledge

11 CS 188: Artificial Intelligence
First-Order Logic Please retain proper attribution and the reference to ai.berkeley.edu. Thanks! Instructor: Stuart Russell University of California, Berkeley

12 Spectrum of representations
Search, game-playing CSPs, planning, propositional logic, Bayes nets, neural nets First-order logic, databases, probabilistic programs

13 Expressive power Rules of chess: Rules of Pacman:
100,000 pages in propositional logic 1 page in first-order logic Rules of Pacman: t Alive(t)  [Alive(t-1)   g,x,y [Ghost(g)  At(Pacman,x,y,t-1)  At(g,x,y,t-1)]]

14 Possible worlds A possible world for FOL consists of: Knows(A, BFF(B))
A non-empty set of objects For each k-ary predicate in the language, a set of k-tuples of objects (i.e., the set of tuples of objects that satisfy the predicate in this world) For each k-ary function in the language, a mapping from k-tuples of objects to objects For each constant symbol, a particular object (can think of constants as 0-ary functions) Knows(A, BFF(B)) 1 2

15 Possible worlds A possible world for FOL consists of: Knows(A, BFF(B))
A non-empty set of objects For each k-ary predicate in the language, a set of k-tuples of objects (i.e., the set of tuples of objects that satisfy the predicate in this world) For each k-ary function in the language, a mapping from k-tuples of objects to objects For each constant symbol, a particular object (can think of constants as 0-ary functions) Knows(A, BFF(B)) 1 2

16 Possible worlds A possible world for FOL consists of: Knows(A, BFF(B))
A non-empty set of objects For each k-ary predicate in the language, a set of k-tuples of objects (i.e., the set of tuples of objects that satisfy the predicate in this world) For each k-ary function in the language, a mapping from k-tuples of objects to objects For each constant symbol, a particular object (can think of constants as 0-ary functions) Knows(A, BFF(B)) 1 2 3 How many possible worlds?

17 Syntax and semantics: Terms
A term refers to an object; it can be A constant symbol, e.g., A , B, EvilKingJohn The possible world fixes these referents A function symbol with terms as arguments, e.g., BFF(EvilKingJohn) The possible world specifies the value of the function, given the referents of the terms BFF(EvilKingJohn) -> BFF(2) -> 3 A logical variable, e.g., x (more later) A B EvilKingJohn 1 2 3

18 Syntax and semantics: Atomic sentences
An atomic sentence is an elementary proposition (cf symbols in PL) A predicate symbol with terms as arguments, e.g., Knows(A,BFF(B)) True iff the objects referred to by the terms are in the relation referred to by the predicate Knows(A,BFF(B)) -> Knows(1,BFF(2)) -> Knows(1,3) -> F An equality between terms, e.g., BFF(BFF(BFF(B)))=B True iff the terms refer to the same objects BFF(BFF(BFF(B)))=B -> BFF(BFF(BFF(2)))=2 -> BFF(BFF(3))=2 -> BFF(1)=2 -> 2=2 -> T A B EvilKingJohn 1 2 3

19 Syntax and semantics: Complex sentences
Sentences with logical connectives ,   ,   ,   ,    Sentences with universal or existential quantifiers, e.g., x Knows(x,BFF(x)) True in world w iff true in all extensions of w where x refers to an object in w x -> 1: Knows(1,BFF(1)) -> Knows(1,2) -> T x -> 2: Knows(2,BFF(2)) -> Knows(2,3) -> T x -> 3: Knows(3,BFF(3)) -> Knows(3,1) -> F A B EvilKingJohn 1 2 3

20 Syntax and semantics: Complex sentences
Sentences with logical connectives ,   ,   ,   ,    Sentences with universal or existential quantifiers, e.g., x Knows(x,BFF(x)) True in world w iff true in some extension of w where x refers to an object in w x -> 1: Knows(1,BFF(1)) -> Knows(1,2) -> T x -> 2: Knows(2,BFF(2)) -> Knows(2,3) -> T x -> 3: Knows(3,BFF(3)) -> Knows(3,1) -> F A B EvilKingJohn 1 2 3

21 Fun with sentences Everyone knows President Obama
There is someone that everyone knows Everyone knows someone

22 More fun with sentences
Any two people of the same nationality speak a common language

23 Inference in FOL Entailment is defined exactly as for PL:
 |=  (“ entails ” or “ follows from ”) iff in every world where  is true,  is also true E.g., x Knows(x,Obama) entails yx Knows(x,y) If asked “Do you know what time it is?”, it’s rude to say “Yes” Similarly, given an existentially quantified query, it’s polite to provide an answer in the form of a substitution (or binding) for the variable(s): KB = x Knows(x,Obama) Query = yx Knows(x,y) Answer = Yes, {y/Obama} Applying the substitution should produce a sentence that is entailed by KB

24 Inference in FOL: Propositionalization
Convert (KB  ) to PL, use a PL SAT solver to check (un)satisfiability Trick: replace variables with ground terms, convert atomic sentences to symbols x Knows(x,Obama) and Democrat(Feinstein) Knows(Obama,Obama) and Knows(Feinstein,Obama) and Democrat(Feinstein) K_O_O  K_F_O  D_F and x Knows(Mother(x),x) Knows(Obama,Obama) and Knows(Mother(Obama),Obama) and Knows(Mother(Mother(Obama)),Obama) ……. Real trick: for k = 1 to infinity, use terms of function nesting depth k If entailed, will find a contradiction for some finite k; if not, may continue for ever; semidecidable

25 Inference in FOL: Lifted inference
Apply inference rules directly to first-order sentences, e.g., KB = Person(Socrates), x Person(x)  Mortal(x) conclude Mortal(Socrates) The general rule is a version of Modus Ponens: Given [x]  [x] and ’, where ’ = [x] for some substitution  conclude [x]   is {x/Socrates} Given Knows(x,Obama) and Knows(y,z)  Likes(y,z)  is {y/x, z/Obama}, conclude Likes(x,Obama) Examples: Prolog (backward chaining), Datalog (forward chaining), production rule systems (forward chaining), resolution theorem provers

26 Summary, pointers FOL is a very expressive formal language
Many domains of common-sense and technical knowledge can be written in FOL (see AIMA Ch. 12) circuits, software, planning, law, network and security protocols, product descriptions, ecommerce transactions, geographical information systems, Google Knowledge Graph, Semantic Web, etc. Inference is semidecidable in general; many problems are efficiently solvable in practice Inference technology for logic programming is especially efficient (see AIMA Ch. 9)


Download ppt "Announcements Midterm is Wednesday March 20, 7pm-9pm "

Similar presentations


Ads by Google