324-lecture4 - Principles Principles of Programming...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
Principles of Programming Languages Lecture 4 Wael Aboulsaadat wael@cs.toronto.edu http://portal.utoronto.ca/ 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Prolog: example 1 Prolog: example 1 – cont’d cont’d Facts 2
Background image of page 2
Prolog: proof procedure Two main processes: – Unification – Top-down reasoning 3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Prolog: unification First step in proof procedure Prolog tries to satisfy a query by unifying it with some conclusion and see if it is true! Process of finding these suitable "assignments" of values to ariables is called nification variables is called unification – It is really a process of pattern matching to make statements identical – How does it compare to variable bindings in imperative world (C/C++/Java/python) ? 4
Background image of page 4
Prolog: unification Prolog: unification – cont’d cont’d Rules of unification: Object 1 Object 2 example result constant free var. 4 X X=4 bound variable free variable X Y Y gets the value of X free variable bound variable X Y X gets the value of Y bound variable constant X b fails if X has a value different then “b” compound object with Variables compound object with constants f(X,Y) f(2,3) X=2, Y=3 compound object with nested
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 08/02/2011.

Page1 / 18

324-lecture4 - Principles Principles of Programming...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online