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
Hi
I got a question concerning the extra slides I showed in lecture 1.
I presented some background in the form of slides about om propositional (boolean) logic and predicate logic.from the course DD1350 (F2,F3,F4) autumn 2017. The same material in presented in the autumn 2018 in DD1351.
You can find material of this type on the net e.g. in wikipedia and on other sites.
I will summarize what of all this information is essential in this course,
but probably not before tomorow's exercise session.
If you want to look for info yourselves , you could use e.g. .search phrases like som "propositional logic".,"predicate logic", "Natural deduction"
Best regards -Thomas S.
Oktober 2017
Summary of lecture week 7
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.
Visa tidigare händelser (1)
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.
Summary of lecture week 6
DCG syntax (Definite clause grammar) to express context dependent grammars directly in Prolog.
How DCG rules are translated into Prolog clauses while xonsulting or compiling.
How you can say that DCG uses difference lists.
Use of DCG rules to write a program that models state transitions,e.g. ab interpretater for a programming language.
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.
Visa tidigare händelser (1)
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
Summary of the lecture week 4
Algorithms over trees and lists. A dictionary implementerad with a sorted open-ended binary tree. reverse, append, merge to keep lists sorted. Defining flatten on nested lists.
The accumulating parameter technique. append3. Considering the complexity. Using append3 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.
Visa tidigare händelser (1)
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.
Summary of the lecture week 3
I presented the model theory for logic programs.
Important concepts:
Herbrand Universe (or term universe) is the set of objects that the program talks about. It is constructed by forming all possible terms using the constants and functors occurring in the program. This set might be finite or infinite.
Herbrand interpretation (or term interpretation) is a set of atoms formed from the Herbrand (term) universe and the repation symbols of the program.
Least Herbrand model. It is the smallest set (a Herbrand interpretation) containing exactly all true atoms in the program and nothing else.
I presented a method how to construct the Least Herbrand model using a fixpoint computation.
I introduced search trees, proofs and proof trees.
I mentioned the soundness and completeness of the SLD-resolution rule.
We then went over to some actual programs.
- proving some arithmetic axioms
- some simple algorithms over trees
I then introduced lists as a subset of structures
- list syntax
- the append relation and its uses:
1) to concatenate sequences represented as lists
2) using append "backwards" to find the initial (or final) part of a list constructed by append and another list.
3) to use append to split a list in two parts.Non-deterministic execution giving all possible subdivisions of a list into two.
Post from the news feed on the course ID2213 logic programming
summary of lecture 2 :
I presented the unification algorithm that handles the equality theory in logic programming.
I also showed how you normally describe the "declarative meaning" of logic programs ("the model theory").
Prolog works using the proof rule Modus Ponens, i.e. to use implication in a proof together with unification of logical variables. This method for proof construction is called SLD resolution.
The unification algorithm generates equalities that are needed in order to prove the statement you are asking for.
When you describe this you speak about "substitutions", a mapping of variables to their values.
This is also called the "binding environment" and is the "values" you get as a result of an execution-
NB that substitutions are a way to describe what the program does, and they are not handled explicitly in programs.
Examples of programs where presented where unification is especially important:
- family relations with structured information about the individuals.
- The Zebra problem, a famous kind of puzzle where the reppresenation is important.
Please ask your questions about exercises in this thread! Then other students who might have the same kind of questions will see our discussion.
It is also possible to send me e-mail and I will answer as soon as possible.
Visa tidigare händelser (6)
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.
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.