Till KTH:s startsida Till KTH:s startsida

Nyhetsflöde

Logga in till din kurswebb

Du är inte inloggad på KTH så innehållet är inte anpassat efter dina val.

I Nyhetsflödet hittar du uppdateringar på sidor, schema och inlägg från lärare (när de även behöver nå tidigare registrerade studenter).

Augusti 2018
Administratör Thomas Sjöland skrev inlägget 29 augusti 2018
 
Oktober 2017
Lärare Thomas Sjöland skrev inlägget 11 oktober 2017
Lärare Thomas Sjöland korrigerade 11 oktober 2017

Summary of lecture week 7

Meta programming. The primitives var, nonvar, ground.¶How to  implement apply in Prolog. map_list as an example of "higher order programming" à la functional programming.¶

Meta programming. The primitives var, nonvar, ground.¶

arg and functor to construct and deconstruct terms.¶

How to collect all solutions in a list:
The primitives findall, bagof and setof.

Self interpreters. The Vanilla prolog interpreter.

Expert systems in Prolog.

 
Lärare Thomas Sjöland skrev inlägget 11 oktober 2017
 
Lärare Thomas Sjöland skrev inlägget 2 oktober 2017
Lärare Thomas Sjöland korrigerade 2 oktober 2017

Summary of lecture week 5

Negation with the NAF-rule (negation as failure).

We defined the !-primitive (cut) and introduced "if-then-else"-syntax.

Search in graphs, and problem formulation med generate-and-test.

permute to generate all possible permutations of a list.

Some examples: N-queens, missionaries and cannibals,

Finding a path in a graph. Avoiding loops in graph search.

Different search methods for parallellism in Prolog was skipped.

All questions on the material are welcome! Use e-mail or this News feed.

 
September 2017
Lärare Thomas Sjöland skrev inlägget 19 september 2017
Lärare Thomas Sjöland korrigerade 29 september 2017

Summary of the lecture week 4

Algorithms over trees and lists. A dictionary implementerad with a sorted open-ended binary tree. Rreverse, append, merge to keep lists sortend. Defining flatten on nested lists.

The accumulating parameter technique. append3. Considering the complexity. Using apopend3 to divide a list in three parts. Which is better ((app o app) o app)  or (app o (app o app))  (using o for relation composition)?

Difference lists. Implementing append for difference lists. Complexity. Consider similarities between using difference lists and the accumulating parameter technique.

Generalising an algorithm by defining separate clauses for representations and equality.

"abstract data types", keeping the represenation separated from the algorithm.

 
Lärare Thomas Sjöland skrev inlägget 13 september 2017
 
Lärare Thomas Sjöland skrev inlägget 8 september 2017
 
Lärare Thomas Sjöland skrev inlägget 8 september 2017
 
under Allmänt

Lärare Thomas Sjöland skapade sidan 2 september 2012

Thomas Sjöland redigerade 2 september 2012

ID2213 Logic Programming. Literature
* We use the book: The Art of Prolog, second Edition, by Leon Sterling and Ehud Shapiro. ISBN 0-262-19338-8. Program examples from the book are available in the ArtOfProlog directory. Solutions to some of the exercises are here.
* You find suggested reading in the kurs-PM and here including a listing of tasks from Sterling and Shapiro that are useful.
* 99 prolog problems
* A thorough, basic and useful tutorial is this one by Paul Brna (also used in the programming paradigm course taken earlier by D-students).
* A very useful tutorial titled "The Logic Programming Paradigm and Prolog" (orig) by prof. Krzysztof R. Apt
* There is a useful little book on programming techniques in Prolog: "Clause and Effect - Prolog Programming for the Working Programmer" by William Clocksin. ISBN 3-540-62971-8. Springer Verlag.
* Some articles are provided by the course leader: such as W.G. Clocksin, Logic Programming and Digital Circuit Analysis, in Journal of Logic Programming 1987:4.
* A good brief summary is found in the material of this course at the Ben Gurion University (look for the three docs found under "Introduction to Logic Programming")
* See the Sicstus Prolog Home Page for the latest version of The SICStus Prolog manual.
Alternative and complementary literature Many alternative books are available. You may need to complement the theory part if you choose other books. On the other hand those books contain many good programming examples.


* The older course book "Logic, Programming and Prolog" by Ulf Nilsson and Jan Maluszynski. Second Edition. ISBN 0-471-95996-0. Wiley, is no longer in print. It is instead available for free download on the web.
* A more modern book more oriented towards AI programming and game programming is "Prolog Programming for Artificial Intelligence" by Ivan Bratko. ISBN 0-201-14224-4. Addison Wesley. It is a useful book that can work as an alternative, even though much of the material of the book is not covered in this course and some additions are needed.
Books articles to read after you have taken this course
* Richard O'Keefe, The Craft of Prolog. ISBN 0-262-15039-5. A book for the advanced Prolog programmer, MIT Press.
* CAD Systems Using AI Techniques. G. Odawara Editor. IFIP. ISBN 0-444-88319-3. North-Holland.

Thomas Sjöland redigerade 2 september 2012

ID2213 Logic Programming. Literature
* We use the book: The Art of Prolog, second Edition, by Leon Sterling and Ehud Shapiro. ISBN 0-262-19338-8. Program examples from the book are available in the ArtOfProlog directory. Solutions to some of the exercises are here.
* You find suggested reading in the kurs-PM and here including a listing of tasks from Sterling and Shapiro that are useful.
* 99 prolog problems
* A thorough, basic and useful tutorial is this one by Paul Brna (also used in the programming paradigm course taken earlier by D-students).
* A very useful tutorial titled "The Logic Programming Paradigm and Prolog" (orig) by prof. Krzysztof R. Apt
* There is a useful little book on programming techniques in Prolog: "Clause and Effect - Prolog Programming for the Working Programmer" by William Clocksin. ISBN 3-540-62971-8. Springer Verlag.
* Some articles are provided by the course leader: such as W.G. Clocksin, Logic Programming and Digital Circuit Analysis, in Journal of Logic Programming 1987:4.
* A good brief summary is found in the material of this course at the Ben Gurion University (look for the three docs found under "Introduction to Logic Programming")
* See the Sicstus Prolog Home Page for the latest version of The SICStus Prolog manual.
Alternative and complementary literature Many alternative books are available. You may need to complement the theory part if you choose other books. On the other hand those books contain many good programming examples.


* The older course book "Logic, Programming and Prolog" by Ulf Nilsson and Jan Maluszynski. Second Edition. ISBN 0-471-95996-0. Wiley, is no longer in print. It is insteadThe book is available for free download on the web.
* A more modern book more oriented towards AI programming and game programming is "Prolog Programming for Artificial Intelligence" by Ivan Bratko. ISBN 0-201-14224-4. Addison Wesley. It is a useful book that can work as an alternative, even though much of the material of the book is not covered in this course and some additions are needed.
Books articles to read after you have taken this course
* Richard O'Keefe, The Craft of Prolog. ISBN 0-262-15039-5. A book for the advanced Prolog programmer, MIT Press.
* CAD Systems Using AI Techniques. G. Odawara Editor. IFIP. ISBN 0-444-88319-3. North-Holland.

Thomas Sjöland redigerade 11 september 2012

ID2213 Logic Programming. Literature
* We use the book: The Art of Prolog, second Edition, by Leon Sterling and Ehud Shapiro. ISBN 0-262-19338-8. Program examples from the book are available in the ArtOfProlog directory. Solutions to some of the exercises are here.
* You find suggested reading in the kurs-PM and here including a listing of tasks from Sterling and Shapiro that are useful.
* 99 prolog problems
* A thorough, basic and useful tutorial is this one by Paul Brna (also used in the programming paradigm course taken earlier by D-students).
* A very useful tutorial titled "The Logic Programming Paradigm and Prolog" (orig) by prof. Krzysztof R. Apt
* There is a useful little book on programming techniques in Prolog: "Clause and Effect - Prolog Programming for the Working Programmer" by William Clocksin. ISBN 3-540-62971-8. Springer Verlag.
* Some articles are provided by the course leader: such as W.G. Clocksin, Logic Programming and Digital Circuit Analysis, in Journal of Logic Programming 1987:4.
* A good brief summary is found in the material of this course at the Ben Gurion University (look for the three docs found under "Introduction to Logic Programming")
* See the Sicstus Prolog Home Page for the latest version of The SICStus Prolog manual.
Alternative and complementary literature Many alternative books are available. You may need to complement the theory part if you choose other books. On the other hand those books contain many good programming examples.


* The older course book "Logic, Programming and Prolog" by Ulf Nilsson and Jan Maluszynski. Second Edition. ISBN 0-471-95996-0. Wiley, is no longer in print. The book is available for free download on the web.
* A more recent book more oriented towards AI programming and game programming is "Prolog Programming for Artificial Intelligence" by Ivan Bratko. ISBN 0-201-14224-4. Addison Wesley. It is a useful book that can work as an alternative, even though much of the material of the book is about AI techniques not covered in this course and some additions are needed.
Books articles to read after you have taken this course
* Richard O'Keefe, The Craft of Prolog. ISBN 0-262-15039-5. A book for the advanced Prolog programmer, MIT Press.
* CAD Systems Using AI Techniques. G. Odawara Editor. IFIP. ISBN 0-444-88319-3. North-Holland.

kommenterade 31 augusti 2017

I have been trying to figure out how to solve exercise (i) for section 2.2 in The art of prolog but I am stuck. The exercise is to add a rule for cannot_meet(Lecturer1,Lecturer2) and previously I have added a rule for busy(Lecturer,Time). What I do not understand is how you can define the cannot_meet/2 rule without also specifying a an argument for Time.

Lärare kommenterade 1 september 2017

You need to look at the representations and define access predicates that use the information given in order to solve the problem. I didn't solve it in detail yet, but I assume modifying the predicate "occupied" on p37 to find out whether two lecturers has some time slot when they are not teaching could be useful. It is possible that you will need negation also to solve this. This hasn't been introduced yet. Let's discuss in class if you didn't succeed!

Perhaps someone else has solved it and could comment here!

Lärare kommenterade 2 september 2017

I think you are right, Jimmy. There has to be some timepoint at which the properly holds. It seems to me that otherwise the question become fairly meaningless, something like "is there some timepoint at which either of the two teachers are busy". If you have a total time frame with a start time and a stop time you might look for a time point (or rather a time interval) when neither of the teachers are teaching.

 
Lärare Thomas Sjöland skrev inlägget 1 september 2017
 
Juni 2015
Lärare Thomas Sjöland skrev inlägget 9 juni 2015