


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This course is an introduction to concepts in programming languages. The course covers a range of programming paradigms including procedural, functional, and logic-based languages. This lecture includes: Prolog Proof Trees, Horn Clause, Dentoes Conjunction, Propositional to Predicate Logic, Universally Quantified, Existentially Quantified, Haskell Pattern
Typology: Study notes
1 / 4
This page cannot be seen from the preview
Don't miss anything!



Today ...
Be careful with variable names
r(X, Y) :- r(X, Z), s(Z, Y).
Checking list membership
member(X, [X | ]). member(X, [ | T]) :- member(X, T).
Q: What is the proof tree for member(2, [1, 2])?
Q: What is the proof tree for member(2, [1, 3])?
Note this example works like pattern matching in Haskell ...
Q: How would we write a last predicate?
last(X, [X]). last(X, [_|T]) :- last(X, T).
Q: What is the proof tree for last(2, [1, 2])?