3 Mar 2004
CS3243 - Inference
37
Logic programming: Prolog
lAlgorithm = Logic + Control
l
lBasis: backward chaining with Horn clauses + bells & whistles
l Widely used in Europe, Japan (basis of 5th Generation project)
l Compilation techniques Þ 60 million LIPS
l
lProgram = set of clauses = head :- literal1, … literaln.
lcriminal(X) :- american(X), weapon(Y), sells(X,Y,Z), hostile(Z).
l
lDepth-first, left-to-right backward chaining
lBuilt-in predicates for arithmetic etc., e.g., X is Y*Z+3
lBuilt-in predicates that have side effects (e.g., input and output
lpredicates, assert/retract predicates)
lClosed-world assumption ("negation as failure")
¡e.g., given alive(X) :- not dead(X).
¡alive(joe) succeeds if dead(joe) fails