CS61A Lecture 27 2011-08-04 Colleen Lewis 1. Clicker poll Have you been reading the provided solutions? A)To labs and/or homework B)To projects C)To labs,

Slides:



Advertisements
Similar presentations
Marina Šenjug, učiteljica razredne nastave PŠ Planina Donja.
Advertisements

Logic Programming Lecture 1: Getting started. Getting started We’ll use SICStus Prolog Free for UofE students Available on all DICE machines
La famille.
EECS 110: Lec 14: Classes and Objects Aleksandar Kuzmanovic Northwestern University
My family By Lisa Simpson. My name is Lisa. I am a girl. I’m eight.
Rinc ó n del Maestro The Family.
American TV Families The Simpsons
let’s revise some words for this topic
THE FUTURE with the Simpsons. Lisa Bart Marge Homer.
…. ... Look at the following pictures of a family, and list five characteristics you can see.
Families. MaleFemale Both grandfather mother cousin daughterchildren grandparents parentsfather brother aunt wife grandmother sister grandson husband.
Alice Variables Pepper. Set to Java look Edit / preferences restart.
Computer Memory 21 oneGrade integer We can declare, assign and manipulate individual variables with ease…
Instructions - on slide 2, students talk about The Simpsons, give their opinions about the cartoon. Encourage sts to use comparatives (so that you can.
© Laurent Jollet – extraTeacher.com HomerMarge Bart Lisa Maggie father mother brother sister son daughter wife husband parents children © Laurent Jollet.
What names? These (1) the Simpsons. They are (2) traditional American family.
Worksheet Part 3 Lisa: My family is big. Bart is my brother. Marge is my mother. Homer is my mother. Maggie is my sister. Abe and.
Possessive Adjectives with The Simpsons
Ch. 9 – FOL Inference Supplemental slides for CSE 327 Prof. Jeff Heflin.
WHAT ARE THE SIMPSONS DOING?
The Simpsons. The Show ► The Simpsons was created my evil masterminds Matt Groening, James L. Brookes, and Sam Simon ► The show has been running strong.
The Simpsons.
SIMPSONS.
T H E S I M P S O N S … He is 36 years old he is a nuclear safety technician, he’s fat and he hasn’t hair. He’s lazy. He likes bowling and watching tv.
The INSANE Simpsons CLICK TO LEARN MORE IF YOU DARE!
The Simpsons Teach Sentences Independent Clause - Marge 1. Marge is an independent woman. She can survive on her own.
By; shacarla hill. The simpson’s Achievements .Holds the guinness book of world records titles for longest-running primetime animated television series.
TO BE & HAVE GOT My name … Homer Simpson. I … a big family.
OCTOBER 13, 2009 Solving Systems of Equations. Objectives Content Objectives Review the addition/elimination method. Learn the substitution method. Language.
Daphne Koller Bayesian Networks Semantics & Factorization Probabilistic Graphical Models Representation.
CS61A Lecture Colleen Lewis. Clicker poll Where do you think you’re learning the most? I assume you’ll learn the most in lab & disc (so.
CS61A Lecture Colleen Lewis 1. Clicker poll Are you allowed to talk about the midterm on piazza or in public yet? A)Yes B)No 2.
CS61A Lecture Colleen Lewis. Clicker poll How do you feel about the “talk to your neighbor” stuff during lecture A)Like it B)It is okay.
Daphne Koller Bayesian Networks Semantics & Factorization Probabilistic Graphical Models Representation.
CS61A Lecture Colleen Lewis. Clicker poll Do you feel comfortable posting questions to piazza? A)Yes with my classmates and instructors.
CS61A Lecture Colleen Lewis 1. Clicker poll Are you in a two person group for project 4? A)Yes – I have my partner B)No – I plan to work.
Families By miss Livia Cortes. Is your family big or small? How many brothers or sisters do you have?
Lisa and Bart, Watch TV Marge, Work as a policewoman.
Objective - To solve work problems Work Rate TimeWork Done Work Rate TimeWork Done 5 hrs.1 Job.
Family Members. This is Bart Simpson and this is his family.
Are has got am is have got TO BE & HAVE GOT.
Mon père s’appelle Homer Possessive Adjectives Mon père s’appelle Homer.
Mon père s’appelle Homer Possessive Adjectives Mon père s’appelle Homer.
F A M I L Y.
THE SIMPSON FAMILY.
Kansas Writing System Fundamentals in the Sentence Writing Strategy
SPARQL Exercise Much of this exercise has been copied from: INF3580/INF4580 – MANDATORY EXERCISE 3
Call Stacks, Arguments and Returns
Family.
THE SIMPSONS.
Intro to Satire April 19, 2018 Please take out the following: - your comp book - a writing utensil.
The Simpsons.
goes skating is talking on the phone
PRESENT SIMPLE.
IMPORTANT FAMILIES ChiaraSbarbada.
SPARQL Exercise Most of this exercise has been copied from: INF3580/INF4580 – MANDATORY EXERCISE 3
Mon père s’appelle Homer Possessive Adjectives Mon père s’appelle Homer.
The simpsons’ family tree
How are we different?.
Whose… is it? Whose …are they?
Phrases with verb + -ing and prepositions
Family tree. family tree Abraham and Mona are Bart’s … parents grandparents grandad.
PRESENT SIMPLE by HERBER.
© Laurent Jollet – extraTeacher.com
The Simpson’s Subjects and verbs
3-3e. Pedigrees Chapter 7.4.
Family members.
One-step addition & subtraction equations: fractions & decimals
The Simpsons.
This is my… Family Insert picture of your family here.
Presentation transcript:

CS61A Lecture Colleen Lewis 1

Clicker poll Have you been reading the provided solutions? A)To labs and/or homework B)To projects C)To labs, homework & projects D)No 2

Clicker poll Are you familiar with the characters from the TV show the Simpsons? A)Yes – very familiar B)Yes – the main characters C)No – I’m not familiar D)No – I’ve never heard of the Simpsons 3

Run (query) and tell it some facts STk> (load "query.scm") okay STk> (query) ;;; Query input: (assert! (colleen likes cookies)) Assertion added to data base. ;;; Query input: 4 Like (mce) : it starts an infinite loop Tell the system facts

Query system goal: Fill in the variables in the query (with all possible sets of values) NEVER fill in the variables with an inconsistent set of variables 5

6

Query: (?who is the parent of bart) 7

TWO facts match: (?who is the parent of bart) ;query (homer is the parent of bart) ;fact (?who is the parent of bart) ;query (marge is the parent of bart) ;fact 8 Query: (?who is the parent of bart) ?who = homer ?who = marge These are frames!

9 All facts ?who = marge QEval ?who = homer Query Query: (?who is the parent of bart)

Query: (marge is the parent of ?x) 10

11 All facts QEval Query Query: (marge is the parent of ?x) How many things did you figure out? A. 0 B. 1 C. 2 D. 3 E. ??

12 All facts QEval Query Query: We can write a query that returns NOTHING NO knowledge of ANY variables, return nothing.

Write a query that returns 0 results 13

Query: (female ?who) 14

15 All facts ?who = mona QEval Query Query: (female ?who) ?who = jackie ?who = marge ?who = patty ?who = selma ?who = lisa ?who = maggie

Query System: and 16

Query: (and (?who is the parent of bart) (female ?who)) 17 Query Goals: Fill in the variables in the query (with all possible sets of values) NEVER fill in the variables with an inconsistent set of variables

Left with TWO facts: (?who is the parent of bart) ;query (homer is the parent of bart) ;fact (?who is the parent of bart) ;query (marge is the parent of bart) ;fact 18 Query: (and (?who is the parent of bart);q1 (female ?who)) ;q2 ?who = homer ?who = marge

19 All facts ?who = marge QEval ?who = homer Query1 Query 1: (?who is the parent of bart)

20 All facts QEval Query2 Query 2: (female ?who) ?who = marge ?who = homer For EACH frame we need to compare it to EVERY fact!

(female ?who) (female mona) 21 Query: (and (?who is the parent of bart);q1 (female ?who)) ;q2 ?who = marge (female ?who) (female marge) … ?who = marge ?who = mona ?who = marge

(female mona) (female jackie) (female marge) (female patty) (female selma) (female lisa) (female maggie) (female ling) 22 Query: (and (?who is the parent of bart);q1 (female ?who)) ;q2 (female mona) (female jackie) (female marge) (female patty) (female selma) (female lisa) (female maggie) (female ling) ?who = marge ?who = homer

23 All facts QEval Query2 Query 2: (female ?who) ?who = marge ?who = homer For EACH frame we need to compare it to EVERY fact! ?who = marge

QEval 24 All facts Query2 ?who = marge ?who = homer ?who = marge QEval All facts Query1 Query: (and (?who is the parent of bart);q1 (female ?who)) ;q2

(and (?who is the parent of bart) (female ?who)) ;;; Query results: (and (marge is the parent of bart) (female marge)) 25 ?who = marge Query Goals: Fill in the variables in the query (with all possible sets of values) NEVER fill in the variables with an inconsistent set of variables

QEval 26 All facts Query2 QEval All facts Query1 Query: (and (mona is the parent of ?x);q1 (?x is the parent of ?y)) ;q2 How many results? A. 0 B. 1 C. 2 D. 3 E.?

QEval 27 All facts Query2 QEval All facts Query1 Query: (and (mona is the parent of ?x);q1 (?x is the parent of ?y)) ;q2 ?x = homer ?x = herb ?x = homer ?y = bart ?x = homer ?y = lisa ?x = homer ?y = maggie

;;; Query input: (and (mona is the parent of ?x) (?x is the parent of ?y)) ;;; Query results: (and (mona is the parent of homer) (homer is the parent of bart)) (and (mona is the parent of homer) (homer is the parent of lisa)) (and (mona is the parent of homer) (homer is the parent of maggie)) 28 ?x = homer ?y = bart ?x = homer ?y = lisa ?x = homer ?y = maggie

QEval 29 All facts Query2 QEval All facts Query1 and

30 QEval All facts Query1 or QEval All facts Query2 merge

31 QEval All facts Query1 QEval All facts Query2 merge (or (?x is the parent of bart) (?x is the parent of lisa)) How many results do you think there SHOULD be? A. 2 B. 4 C.?

32 QEval All facts Query1 QEval All facts Query2 (or (?x is the parent of bart) (?x is the parent of lisa)) merge ?x = marge ?x = homer ?x = marge ?x = homer ?x = marge ?x = homer ?x = marge ?x = homer

;;; Query input: (or (?x is the parent of bart) (?x is the parent of lisa)) ;;; Query results: (or (marge is the parent of bart) (marge is the parent of lisa)) (or (homer is the parent of bart) (homer is the parent of lisa)) (or (marge is the parent of bart) (marge is the parent of lisa)) (or (homer is the parent of bart) (homer is the parent of lisa)) 33 ?x = marge ?x = homer ?x = marge ?x = homer

;;; Query input: (or (?x is the parent of bart) (?x is the parent of ling)) ;;; Query results: 34

;;; Query input: (or (?x is the parent of bart) (?x is the parent of ling)) ;;; Query results: (or (marge is the parent of bart) (marge is the parent of ling)) (or (homer is the parent of bart) (homer is the parent of ling)) (or (selma is the parent of bart) (selma is the parent of ling)) 35 ?x = marge ?x = homer ?x = selma

QEval 36 All facts the-body QEval All facts Query rules ;;; Query input: (assert! (rule )) When a rule (a type of fact) matches, do this:

rules ;;; Query input: (assert! (rule (parent-of-bart ?person) (?person is the parent of bart))) 37 the-rule the-body

QEval 38 All facts the-body QEval All facts Query rules (rule (parent-of-bart ?person) (?person is the parent of bart))) ;;; Query input: (parent-of-bart ?who) ?person = ?who ?who = marge ?person = ?who ?who = homer