# Register now to access 7 million high quality study materials (What's Course Hero?) Course Hero is the premier provider of high quality online educational resources. With millions of study documents, online tutors, digital flashcards and free courseware, Course Hero is helping students learn more efficiently and effectively. Whether you're interested in exploring new subjects or mastering key topics for your next exam, Course Hero has the tools you need to achieve your goals.

14 Pages

### 0.day2

Course: ESSLLI 04, Fall 2009
School: Union College
Rating:

Word Count: 1039

#### Document Preview

programming: Prolog a do-it-yourself course for beginners Day 2 Kristina Striegnitz Department of Computational Linguistics Saarland University, Saarbrucken, Germany kris@coli.uni-sb.de http://www.coli.uni-sb.de/~kris Day 2: Matching and Proof Search p.1 Day 2: Matching and Proof Search Today: recursive predicate definitions how Prolog answers queries Reader: Lectures 2 and 3 of Learn Prolog Now! Day 2:...

Register Now

#### Unformatted Document Excerpt

Coursehero >> Nebraska >> Union College >> ESSLLI 04

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
programming: Prolog a do-it-yourself course for beginners Day 2 Kristina Striegnitz Department of Computational Linguistics Saarland University, Saarbrucken, Germany kris@coli.uni-sb.de http://www.coli.uni-sb.de/~kris Day 2: Matching and Proof Search p.1 Day 2: Matching and Proof Search Today: recursive predicate definitions how Prolog answers queries Reader: Lectures 2 and 3 of Learn Prolog Now! Day 2: Matching and Proof Search p.2 Ancestors parent of(paul,petunia). Paul Helen Albert Ruth parent of(helen,petunia). parent of(paul,lili). parent of(helen,lili). parent of(albert,james). parent of(ruth,james). parent of(petunia,dudley). parent of(vernon,dudley). parent of(lili,harry). parent of(james,harry). Vernon Petunia Lili James Harry Dudley Task: Define a predicate ancestor of(X,Y) which is true if X is an ancestor of Y. Day 2: Matching and Proof Search p.3 Ancestors (cont.) grandparent of(X,Y) :- parent of(X,Z), parent of(Z,Y). greatgrandparent of(X,Y) :- parent of(X,Z), parent of(Z,A), parent of(A,Y). greatgreatgrandparent of(X,Y) :- parent of(X,Z), parent of(Z,A), parent of(A,B), parent of(B,Y). Doesn't work for ancestor of; don't know "how many parents we have to go back". ancestor of(X,Y) :- parent of(X,Y). People are ancestors of their children, ancestor of(X,Y) :- parent of(X,Z), ancestor of(Z,Y). and they are ancestors of anybody that their children may be ancestors of (i.e., of all the descendants of their children). Day 2: Matching and Proof Search p.4 Ancestors (cont.) grandparent of(X,Y) :- parent of(X,Z), parent of(Z,Y). greatgrandparent of(X,Y) :- parent of(X,Z), parent of(Z,A), parent of(A,Y). greatgreatgrandparent of(X,Y) :- parent of(X,Z), parent of(Z,A), recursion parent of(A,B), parent of(B,Y). Doesn't work for ancestor of; don't know "how many parents we have to go back". ancestor of(X,Y) :- parent of(X,Y). People are ancestors of their children, ancestor of(X,Y) :- parent of(X,Z), ancestor of(Z,Y). and they are ancestors of anybody that their children may be ancestors of (i.e., of all the descendants of their children). Day 2: Matching and Proof Search p.5 Example 1 KB: wizard(harry). wizard(ron). wizard(hermione). muggle(uncle vernon). muggle(aunt petunia). chases(crookshanks,scabbars). Query: ?- wizard(hermione). yes Easy: wizard(hermione) is a fact in the knowledge base. Day 2: Matching and Proof Search p.6 Example 2 KB: wizard(harry). wizard(ron). wizard(hermione). muggle(uncle vernon). muggle(aunt petunia). chases(crookshanks,scabbars). Query: ?- wizard(X). X = harry ; X = ron ; X = hermione ; no The query wizard(X) matches the fact wizard(harry). This instantiates the variable X with harry. It also matches the facts wizard(ron) and wizard(hermione). Day 2: Matching and Proof Search p.7 Matching Two atoms match if they are the same atom. Ex.: harry = harry, but harry \= 'Harry'. A variable matches any other Prolog term. The variable gets instantiated with the other term. Ex.: X = wizard(harry) Ex.: = X Y Two complex terms match if they have the same functor and the same number of arguments and if all pairs of parallel arguments match. Ex.: like(harry,hargrid) = like(harry,X) Ex.: like(harry,hargrid) = like(harry,X,Y) Ex.: like(harry,hargrid) \= like(X,X) Day 2: Matching and Proof Search p.8 Back to Example 2 KB: wizard(harry). wizard(ron). wizard(hermione). muggle(uncle vernon). muggle(aunt petunia). chases(crookshanks,scabbars). Query: ?- wizard(X). X = harry ; X = ron ; X = hermione ; no Prolog checks for facts that match the query. (There are three.) Prolog starts from the top of the knowledge base and, therefore, finds wizard(harry) first. Typing ; forces Prolog to check whether there are other possibilities. Day 2: Matching and Proof Search p.9 Example 3 KB: eating(dudley). happy(aunt petunia) :- happy(dudley). happy(uncle vernon) :- happy(dudley),unhappy(harry). happy(dudley) :- kicking(dudley,harry). happy(dudley) :- eating(dudley). Query: ?- happy(aunt petunia). yes Check for a fact or a rule's head that match the query. If you find a fact, you're done. If you find a rule, prove all goals specified in the body of the rule. Day 2: Matching and Proof Search p.10 Example 4 KB: eating(dudley). happy(aunt petunia):-happy(dudley). happy(uncle vernon):-happy(dudley),unhappy(harry). happy(dudley):-kicking(dudley,harry). happy(dudley):-eating(dudley). Query: ?- happy(X). happy(X) X=ap happy(d) X=uv X=d X=d kicking(d,h) eating(d) happy(d),unhappy(h) kicking(d,h) eating(h) kicking(d,h),unhappy(h) eating(d),unhappy(h) X=d X=ap unhappy(d) Day 2: Matching and Proof Search p.11 Example 5 father(albert,james). father(james,harry). mother(ruth,james). mother(lili,harry). wizard(lili). wizard(ruth). wizard(albert). wizard(X) :father(Y,X), wizard(Y), mother(Z,X), wizard(Z). ...

Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Union College - ESSLLI - 04
Prolog programming: a do-it-yourself course for beginnersDay 1Kristina Striegnitz Department of Computational Linguistics Saarland University, Saarbrucken, Germany kris@coli.uni-sb.de http:/www.coli.uni-sb.de/krisDay 1: Facts, Rules, and Querie
Union College - ESSLLI - 04
Prolog programming: a do-it-yourself course for beginnersDay 4Kristina Striegnitz Department of Computational Linguistics Saarland University, Saarbrucken, Germany kris@coli.uni-sb.de http:/www.coli.uni-sb.de/~krisDay 4: Definite Clause Grammar
Union College - ESSLLI - 04
Prolog programming: a do-it-yourself course for beginnersDay 3Kristina Striegnitz Department of Computational Linguistics Saarland University, Saarbrucken, Germany kris@coli.uni-sb.de http:/www.coli.uni-sb.de/~krisDay 3: Lists p.1Day 3: List
Union College - ESSLLI - 04
Prolog programming: a do-it-yourself course for beginnersDay 5Kristina Striegnitz Department of Computational Linguistics Saarland University, Saarbrucken, Germany kris@coli.uni-sb.de http:/www.coli.uni-sb.de/~krisDay 5: Definite Clause Grammar
Wisconsin - RACES - 2002
Track: Nurburg Sun Dec 30 23:01:30 2001PRACTICE TIMESPos No Driver Team Nat Time Diff Laps 1 17 Mike Eppel Cooper CAN 8m26.965s 3 2 16 Chris Bayly
Wisconsin - RACES - 2002
Track: Nurburg Sun Dec 30 13:23:36 2001PRACTICE TIMESPos No Driver Team Nat Time Diff Laps 1 3 Herbert Pohlai Brabham AUT 8m10.510s 2 2 16 Hannu Piispa
Wisconsin - RACES - 2002
Track: Monaco Sat Mar 09 22:09:52 2002Driver: speedcenter5 - Brabham No practice lapsNo race lapsDriver: Alan Owens - Eagle Practice lapsLap 1: 1m30.880sLap 2: 1m30.381sLap 3: 1m28.253sLap 4: 2m42.032s [Invalid lap]La
Wisconsin - RACES - 2002
Track: Nurburg Sun Apr 07 11:51:58 2002PRACTICE TIMESPos No Driver Team Nat Time Diff Laps 1 3 Warren BennettF1 Brabham NZL 8m09.194s 3 2 8 Herbert Pohlai
Wisconsin - RACES - 2002
Track: Keimola Sun Mar 17 12:54:52 2002PRACTICE TIMESPos No Driver Team Nat Time Diff Laps 1 2 Petra Kienast Lotus GER 1m16.922s 19 2 8 Ed Hut
Wisconsin - RACES - 2003
Track: Nurburg Wed Jul 23 22:34:00 2003PRACTICE TIMESPos No Driver Team Nat Time Diff Laps 1 15 Alex Tikhonov Cooper CAN 8m09.563s 2 2 16 Scott Tuggle
Wisconsin - RACES - 2003
Track: Nurburg Sun Dec 22 23:20:40 2002PRACTICE TIMESPos No Driver Team Nat Time Diff Laps 1 16 Alex Tikhonov BRM CAN 8m15.705s 5 2 3 Urban Alsenmyr
Wisconsin - RACES - 2002
Track: Nurburg Sun Apr 07 01:29:20 2002PRACTICE TIMESPos No Driver Team Nat Time Diff Laps 1 14 Alan Owens Eagle IRE 8m13.559s 1 2 17 Alex Tikhonov
Wisconsin - RACES - 2003
Track: Bsarthe Sat Jun 07 23:08:53 2003PRACTICE TIMESPos No Driver Team Nat Time Diff Laps 1 18 Peter Burke Lotus GER 3m18.155s 10 2 15 Jon Purdy
Wisconsin - RACES - 2002
Track: Mosport Sun Apr 14 22:34:05 2002PRACTICE TIMESPos No Driver Team Nat Time Diff Laps 1 10 Jerry Seutter Brabham CAN 1m22.632s 18 2 7 Jim Fekete
Wisconsin - RACES - 2002
Track: Ims Sun May 26 12:36:44 2002PRACTICE TIMESPos No Driver Team Nat Time Diff Laps 1 2 Ed Hut Lotus HOL 52.458s 16 2 17 Petra Kienast
Wisconsin - RACES - 2003
Track: Reims Sat Apr 05 23:16:24 2003PRACTICE TIMESPos No Driver Team Nat Time Diff Laps 1 3 Paul Jackson Ferrari USA 1m58.896s 13 2 15 Marc Fraioli
Wisconsin - RACES - 2003
Track: Mosport Sun Feb 23 01:19:22 2003PRACTICE TIMESPos No Driver Team Nat Time Diff Laps 1 17 Keith Allsop Cooper USA 1m21.397s 19 2 16 Robert Smith
Wisconsin - RACES - 2003
Track: Spa Sat Apr 19 23:28:24 2003PRACTICE TIMESPos No Driver Team Nat Time Diff Laps 1 9 Paul Jackson Ferrari RSA 3m15.286s 11 2 16 Peter Burke
Wisconsin - RACES - 2003
Track: Spa Sun Apr 20 22:56:56 2003PRACTICE TIMESPos No Driver Team Nat Time Diff Laps 1 8 Petra Kienast Lotus GER 3m19.043s 9 2 18 Dick Barker
Wisconsin - RACES - 2004
Track: Monaco Sun Nov 23 22:43:14 2003PRACTICE TIMESPos No Driver Team Nat Time Diff Laps 1 9 Joe Prinkins Cooper USA 1m26.846s 22 2 2 Peter Burke
Wisconsin - RACES - 2003
Track: Mexico Sun Oct 27 22:34:11 2002PRACTICE TIMESPos No Driver Team Nat Time Diff Laps 1 12 Jim Fekete Ferrari USA 1m48.729s 15 2 20 Peter Burke
Wisconsin - RACES - 2003
Track: Rouen Sun Mar 23 22:42:00 2003PRACTICE TIMESPos No Driver Team Nat Time Diff Laps 1 11 Alex Tikhonov BRM CAN 1m58.229s 18 2 12 Keith Allsop
Wisconsin - RACES - 2003
Track: Watglen Sat Sep 07 22:48:22 2002PRACTICE TIMESPos No Driver Team Nat Time Diff Laps 1 8 Keith Allsop Ferrari USA 1m04.918s 27 2 2 Alan Owens
Union College - MER - 231
Union College - PHY - 18
Electromagnetic Induction Current Induced in a Straight Conductor Current Induced in a Loop of Wire Faradays Law of Induction Magnetic Flux Lenzs Law HomeworkCurrent Induced in a Straight Conductor A conductor of length moves with velocity t
Union College - IMP - 13
Integrated Math/Physics 13 SyllabusSpring 2005 Instructors Name Ofce Michael Vineyard S&amp;E N310 Karl Zimmermann Bailey 108C Class Meeting Times Monday, Wednesday, and Friday 10:50 - 11:55 AM and 1:45 - 2:50 PM Thursday 8:50 - 10:40 AM Texts Calculus
Union College - PHY - 18
Physics 18 Test 2Spring 2003Name_ Section_Problem Score 1 2 3 4 TotalIn keeping with the Union College policy on academic honesty, it is assumed that you will neither accept nor provide unauthorized assistance in the completion of this work.
Union College - PHY - 310
Physics 310Union CollegeHomework #4Due Wednesday, October 5 Review problem: 1. [Das &amp; Ferbel, XIII.2&amp;3] Draw Feynman diagrams for the following interactions: (a) K+ + + 0 (b) + + + (c) K0 - + e + e+ (d) p + p 0 + K+ + p (e) + p +
Union College - PHY - 310
Physics 310Union CollegeHomework #7Due Monday, October 31 1. Dunlap, Chapter 5, 5.3 2. [Das &amp; Ferbel, III.5] What would you expect for the spin and parity of the ground states of 23 Na, 35Cl, and 41Ca on the basis of the single particle shell mo
Union College - ECO - 243
Economics 243 Union College, Winter 2008Younghwan SongINTRODUCTION TO ECONOMETRICSClass: Office: Office Hours: Office Phone: E-mail:Mon, Wed, Fri 11:45AM-12:50 PM, Bailey 201 Social Sciences 109 Wed 4-5 PM, Thu 3-5 PM, and by appointment 388-
Union College - CSC - 070
Class PrepBring In-Class Exercise Paper for Classroom Printer Class Roster Course Outline, Grading &amp; Policies Programming Standards &amp; Documentation HW #1 Set up HannayD folder under My Documents (or H:/csc070) Run Excel Run &quot;washer.m&quot;
Union College - CSC - 077
CSc-077 H.W. #5 (due 10-May-2001)Animated HeapProject P-7.4 [page 330] Develop an applet or standalone program that uses a Frame to animate the heap. Your program should support all the priority queue operations and it should visualize the operati
Union College - CSC - 105
CSc-105 HW #3 &quot;Class Grades Breakdown&quot; (due 28 September 2005) Assignment This assignment is based on Projects 7 and 9 on page 179 of the text. Your applet should create both graphs appropriately placed on the same applet window. (bar chart and pie c
Union College - MER - 331
Union College - SCOTER - 331
Union College - MER - 331
Union CollegeMER331 Fluid MechanicsExperiment #1 - Measuring ViscosityPurpose:The purpose of this lab is to determine the viscosities of 3 oil samples (Oils A, B, and C) using three measurement techniques: rotational, falling ball and capillary
Union College - SCOTER - 331
Union CollegeMER331 Fluid MechanicsExperiment #1 - Measuring ViscosityPurpose:The purpose of this lab is to determine the viscosities of 3 oil samples (Oils A, B, and C) using three measurement techniques: rotational, falling ball and capillary
Union College - SCOTER - 331
Appendix A: Instructions for Brookfield Rotational ViscometerA-1I. INTRODUCTIONThe Brookfield Dial Viscometer measures fluid viscosity at given shear rates. Viscosity is a measure of a fluid's resistance to flow. You will find a detailed descrip
Union College - MER - 331
Union CollegeMer331 Fluid MechanicsRace Car Aerodynamics ProjectPurpose:The purpose of this project is to learn about the aerodynamic design of race cars and how it relates to lift and drag forces. In addition you will be introduced to techniq
Union College - SCOTER - 331
Union CollegeMer331 Fluid MechanicsRace Car Aerodynamics ProjectPurpose:The purpose of this project is to learn about the aerodynamic design of race cars and how it relates to lift and drag forces. In addition you will be introduced to techniq
Union College - SCOTER - 331
Union CollegeLab 6Mer331 Fluid MechanicsLab #6: Race Car Aerodynamics Lift and DragPurpose:The purpose of this weeks lab exercise is to measure the lift and drag forces acting on the radio controlled vehicle that your group is studying. Dra
Union College - MER - 331
MER331 Fluid MechanicsProf. AndersonGuidelines for Lab NotebooksWhy Maintain A Detailed Laboratory Notebook? Keeping a detailed laboratory notebook is good engineering practice in industry and academia: it can be used to support the validity of
Union College - SCOTER - 331
MER331 Fluid MechanicsProf. AndersonGuidelines for Lab NotebooksWhy Maintain A Detailed Laboratory Notebook? Keeping a detailed laboratory notebook is good engineering practice in industry and academia: it can be used to support the validity of
Union College - SCOTER - 331
Mer331 Fluid MechanicsProf AndersonPREPARATION OF PROBLEM ASSIGNMENTSACADEMIC HONESTY and WORKING TOGETHER ON HOMEWORK: Please follow these guidelines when working on homework: 1. You are allowed to work together. This is one of the best ways
Union College - SCOTER - 160
Mer160 Thermal Fluids DesignAMA, BAB, PGKBoats ` R Us Putt-Putt Boat Design CompetitionOur class has been contracted to design a new Putt-Putt boat. To prove our worthiness we will hold a competition to see who can design the best boat. PROBLEM
Union College - SCOTER - 331
Union CollegeLab 5Me 331 Fluid MechanicsLab #5:Imaging and Computing Flow Around a Radio Control VehiclePurposeThe purpose of this lab is to learn about Particle Image Velocimetry techniques and to make instantaneous full field velocity me
Union College - SCOTER - 3
Greetings Brent, Greg, Luis, Chukwuma, Gordon, Shane, Jay, Price, Jared and Mike, There is another exciting book required for the course on Marketing ME Senior Projects. The book is: Rhonda Abrams, The Successful Business Plan, Secrets and Strategies
Union College - SCOTER - 3
Union College - SCOTER - 3
Union College - SCOTER - 3
Union College - SCOTER - 439
MER439: Design of Thermal/Fluid SystemsDesign Project Number 2: A Winery Fluid Transport System.In this project your team forms the basis of a consulting firm that specializes in the design of all kinds of fluid transport systems. You contract you
Union College - SCOTER - 439
Union College - MER - 331
Race Car AerodynamicsMER331- Lab 3Purpose Characterize the aerodynamic performance of radio controlled vehiclesMethods Surface Pressure Distribution Measurement Lift/Drag Force Measurements PIV (Particle Image Velocimetry)The Impact of Aer
Union College - SCOTER - 331
Race Car AerodynamicsMER331- Lab 3Purpose Characterize the aerodynamic performance of radio controlled vehiclesMethods Surface Pressure Distribution Measurement Lift/Drag Force Measurements PIV (Particle Image Velocimetry)The Impact of Aer
Union College - CSC - 070
Class PrepBring Washers In-Class Exercise Paper for Classroom PrinterMATLAB to HannayD folder under My Documents (or H:/csc070)Hand out Washers Students use dimensions of their own washer for exercise Measured in cmCSc-070: Intro
Union College - CSC - 070
Class PrepBring to Class In-Class Exercises Paper for Classroom Printer Copy over all scriptsCheck directory on Console PCRun MATLABGet Sample ProgramsCopy sentinel_loop.m, NewtonSqrt.m from course folder week 4 to your sub-fold
Union College - CSC - 070
Class PrepBring to Class In-Class Exercise Paper for Classroom Printer Answers to HW 1b and 1cCheck HannayD folder under My Documents (or H:/csc070) Run MATLABSet Current DirectoryStart up MATLAB Run MATLAB Change MATLAB Current
Union College - CSC - 070
Class PrepBring to Class Deck of Cards In-Class Exercises Paper for Classroom Printer Copy over all scriptsCheck Current Directory FolderRun MATLABHW 3a Solutioncol = linspace(200,1000,5)'; Jeopardy = col*ones(1,6) DoubleJeopardy =
Union College - CSC - 070
Class PrepBring In-Class Exercise Paper for Classroom PrinterMATLAB to HannayD folder under My Documents (or H:/csc070)CSc-070: Intro to Programming for EngineersWeek 01-c(2.1-2.3)Numeric vs. Character Data &quot;Hiding&quot; System Variables
Union College - CSC - 070
Class PrepBring In-Class Exercises Homework #3 Paper for Classroom Printer Load Script Files into correct folder Run MATLABHW 2a Solution% solving y = mx + c % with (x-a)^2 + (y-b)^2 = r^2 % for x after some work gives % Ax^2 + Bx + C =
Union College - CSC - 070
CSc-070 Test #2 22-Oct-2007 Name (extensive comments are not required, but meaningful variable names should be used throughout) 1. Write a script to ask the user for the current temperature. Display the message &quot;too hot&quot; if the temperature is over 90