1 Logic Programming School of Informatics, University of Edinburgh append/3 A Drosophila of L.P. append([], L, L) append([ H | T ], L, [ H | R ])  append(T,

Slides:



Advertisements
Similar presentations
What is the capital of the UK? London What is the capital of France? Paris.
Advertisements

1 Logic Programming School of Informatics, University of Edinburgh Forcing Determinacy: Example minimum(X, Y, X) :- X =< Y. minimum(X, Y, Y) :- X > Y.
This project and its actions were made possible due to co-financing by the European Fund for the Integration of Third-Country Nationals World War 2 map.
1 Logic Programming School of Informatics, University of Edinburgh Transformations Specification-Program An introduction to moving between Prolog and First.
Study Project The Countries and Capitals of the European Union.
QOTD 1/29/10#14 Get out #14 Write today’s date in the margin Get with your partner from yesterday Use your notebook #17-18 to answer the following questions.
Longitude/Latitude Prime Meridian/Equator Oceans Tropics Continents
Political Map of Europe. 1. British Isles 2. Nordic Nations 3. Central Western Europe 4. Mediterranean Europe 5. Eastern Europe.
Folke Sjöqvist and Michael Orme 1 Questionnaire on Clinical Pharmacology.
by the way we 1.Introduction: Cultural Norms and Values - Stereotyping American culture Chinese culture.
An introduction. Before the Euro Before the Euro each country in the EU had it’s own currency. Germany - the Deutschmark France – the Franc Italy – The.
Intergenerational contributions to childcare across Europe Alison Smith University of Edinburgh.
France The flag of France is blue, white and red.
Poverty & Human Capability 101 Introductory Class.
FATIH UNIVERSITY Department of Computer Engineering Programming Style and Technique Notes for Ch.8 of Bratko For CENG421&553 Fall03.
The large land areas are called continents. There are seven continents.
1-1 Introduction Logic programming languages, sometimes called declarative programming languages Express programs in a form of symbolic logic Use a logical.
European County Research Project. Task Your job is to research a country from Europe. Your job is to research a country from Europe. You will be exploring.
Session 4 “Assessing research integration and its potential impact” Prof. Beate Kohler-Koch University of Mannheim / University of Bremen Findings from.
Monday, August 29, 2011 Homeroom: Use the restroom before class starts. You will not be able to go again until 2 nd period. Use the restroom before class.
By Millie Elner Gibbs. Belgium map Belgium facts Belgium's climate is moderate, with hardly any extremes in temperature throughout the year. It rains.
Candidates Belgium France Italy Luxembourg Netherlands United Kingdom Germany Denmark Ireland GreecePortugal Spain Austria.
1. Objective (READ) SWBAT explain why Western Europe is more developed than Eastern Europe. 2. Question of the Day. (WRITE) 3. Warm-up (ANSWER) 1. Is the.
Political Map of Europe Western European Countries.
Northern Europe Label the following countries on the next page, using the color each countries is labeled in: -United Kingdom (blue) -Ireland (green) -Iceland.
Logic Programming and Prolog Goal: use formalism of first-order logic Output described by logical formula (theorem) Input described by set of formulae.
In the Neighborhood of the Camp Kistarcsa 2012 The new member states of the European Union and possibilities for the expansion (workshop) Presented by.
1. Objective (READ) SWBAT explain why Western Europe is more developed than Eastern Europe. 2. Question of the Day. (WRITE) 3. Warm-up (ANSWER) 1. Is the.
Map - Region 3 Europe.
Chapter 27 Chapter 27 Geographic Variability in Hip and Vertebral Fractures Copyright © 2013 Elsevier Inc. All rights reserved.
Flags of Europe By Mazzy1999. Austria Here is Austria’s flag!The colours are red and white.I have never been to Austria.
Europe – The Continent Learning Objectives:  To explore the continent of Europe  To develop your knowledge of Europe’s physical and Human Features Key.
Teams of the 2010 World Cup A short introduction to each team.
Key Events in North America Colored Maps Color Key France = red Spain = yellow US = blue Great Britain (England) = green Mexico = purple.
Title: World Cup Countries.
The 19 th of June 1990 : The Schengen Implementing Convention has been signed by : - Germany - Belgium - France - Luxembourg - Netherlands Calendar.
OAKWOOD CAPITAL MANAGEMENT LLC Annual Return (%) Equity Returns of Developed Markets Boxed Return is highest return for the year. In US dollars. Source:
Geography Review On Map 1, please identify: -Spain -France -England -Russia -Ottoman empire -Persia -China -Mughal India -Songhai Empire.
Northern Europe Label the following countries on the next page, using the color each countries is labeled in, then add capitals to each country using a.
1914 European Map Details. Nations to locate 1.Albania 2.Austria-Hungary 3.Belgium 4.Bulgaria 5.Denmark 6.France 7.Greece 8.Germany 9.Italy 10.Luxemburg.
Maps of Topic 2B Multilingualism in Europe Europe A Story of Empire (a united Europe) & Language.
France Ireland Norway Sweden Finland Estonia Latvia Spain Portugal Belgium Netherlands Germany Switzerland Italy Czech Rep Slovakia Austria Poland Ukraine.
Best Sustainable Development Practices for Food Security UV-B radiation: A Specific Regulator of Plant Growth and Food Quality in a Changing Climate The.
USD billion

Countries and Capitals of Western Europe
DISTRIBUTION AUTOMATIC - GENERATION
ALIGNMENT RULE PROCEDURE
Snapshot of Global PV Markets
EUROS Identification Austria - Belgium - Cyprus - Estonia - Finland - France - Germany - Greece - Ireland - Italy - Latvia Lithuania - Luxembourg - Malta.
The European Parliament – voice of the people
The European Parliament – voice of the people
Намалување на загадувањето на воздухот со електромобилност
Map #1 – The Early Alliances
EUROPEAN UNION the “EU”
Adriatic Persian Gulf Map Test #1 Answers.
European Union Membership
Today is a special day ... It is the 10 year anniversary of ...
Do Now for Monday, October 10
ALIGNMENT RULE PROCEDURE
COUNTRIES TO LABEL MAP OF EUROPE Austria Belarus Belgium Bulgaria
Adriatic Persian Gulf Map Test #1 Answers.
European representation of respiratory critical care HERMES participants. European representation of respiratory critical care HERMES participants. Countries.
Update on reporting status
WEST EUROPE MAP REVIEW.
1914 European Map Details.
WWI map directions.
2006 Rank Adjusted for Purchasing Power
Prodcom Statistics in Focus
Presentation transcript:

1 Logic Programming School of Informatics, University of Edinburgh append/3 A Drosophila of L.P. append([], L, L) append([ H | T ], L, [ H | R ])  append(T, L, R) append([], L) = L append([ H | T ], L) = [H | append(T, L) ] As functions: As a logic program

2 Logic Programming School of Informatics, University of Edinburgh append/3 A Drosophila of L.P. append([], L, L) append([ H | T ], L, [ H | R ])  append(T, L, R) Goals: append([a,b,c], [d,e], X) append(X, [d,e], [a,b,c,d,e]) append([a,b,c], X, [a,b,c,d,e]) append(X, Y, [a,b,c,d,e]) append([a,b,c], X, Y) X = [a,b,c,d,e] X = [a,b,c] X = [d,e] X = [], Y = [a,b,c,d,e] ; X = [a], Y = [b,c,d,e]; etc Y = [a,b,c | X ] Results:

3 Logic Programming School of Informatics, University of Edinburgh Introduction to Negation as Failure In Prolog the goal \+ G succeeds if no instance of G can be found by Prolog’s proof mechanism; otherwise it fails. p(X) :- q(X). q(1). q(2). r(2). s(3). Given: Goals: \+ (p(1), r(1)). \+ (p(2), r(2)). \+ p(X). \+ (p(X), s(X)). yes no yes Results:

4 Logic Programming School of Informatics, University of Edinburgh Generating a Set of Results setof(X, Goal, Set) generates the set, S, of instances of X generated by exhaustively satisfying the given Goal. p(X) :- q(X). q(1). q(2). r(2). s(3). Given: Goals: setof(X, p(X), S). setof(X, (p(X), r(X)), S). setof(X, (p(X) ; s(X)), S). setof(X, (p(X), s(X)), S). S = [1,2] S = [2] S = [1,2,3] no Results:

5 Logic Programming School of Informatics, University of Edinburgh Building Larger Definitions: Map Colouring The four colour theorem says that any 2- dimensional map can be coloured, with no bordering country sharing the same colour, using only four different colours.

6 Logic Programming School of Informatics, University of Edinburgh A Logic Program Requirement Define a predicate colour_countries(X) that generates in X a list of terms [c(S,C),…], where S is a country and C is one of four colours. The predicate must be able to generate each combination of countries and colours satisfying the four-colour theorem but no combinations that do not satisfy the theorem. An example behaviour is: | ?- colour_countries(X). X=[c(austria,red), c(belgium,green), c(denmark,yellow), c(france,red), c(germany,blue), c(italy,blue), c(netherlands,yellow), c(portugal,blue), c(spain,yellow), c(switzerland,yellow)]

7 Logic Programming School of Informatics, University of Edinburgh A Representation of a Map ngb(portugal, [spain]). ngb(spain, [portugal,france]). ngb(france, [spain,belgium,switzerland,germany,italy]). ngb(belgium, [france,germany,netherlands]). ngb(netherlands, [belgium,germany]). ngb(germany, [netherlands,belgium,france,switzerland,austria,denmark]). ngb(switzerland, [france,germany,austria,italy]). ngb(austria, [germany,switzerland,italy]). ngb(italy, [france,switzerland,austria]). ngb(denmark, [germany]). Note this is not the only representation we could have used. The art is to describe the salient and essential details of the problem, and no more than this.

8 Logic Programming School of Informatics, University of Edinburgh Generating Individual Neighbours neighbour(Country, Country1) :- ngb(Country, Neighbours), member(Country1, Neighbours). member(X, [ X | _ ]). member(X, [ _ | T ]):- member(X, T).

9 Logic Programming School of Informatics, University of Edinburgh Colouring the Countries colour_countries(Colours) :- setof(c(Country,_), X^ngb(Country,X), Colours), colours(Colours). colours([]). colours([ c(Country,Colour) | Rest ]) :- colours(Rest), member(Colour, [yellow,blue,red,green]), \+ ( member(c(Country1,Colour), Rest), neighbour(Country, Country1) ).