73
A Taste of Prolog Aja Hammerly Thursday, August 2, 12

A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

A Taste of PrologAja Hammerly

Thursday, August 2, 12

Page 2: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

Basics

• I Like Prolog

• But, I'm not an expert

• This is just an introduction

Thursday, August 2, 12

Page 3: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

What Is Prolog

• A logic programing language

• A declarative programming language

• A weird programming language

Thursday, August 2, 12

Page 4: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

Uses

• Natural Language Processing

• Grammars

• Theorem Proving

• Expert Systems and other AI

Thursday, August 2, 12

Page 5: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

Why Learn Prolog

• Expand your toolbox

• New perspective

• Become a polyglot

Thursday, August 2, 12

Page 6: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

Prolog - Weirdness

• “What”, not “How”.

• Programs are expressed as:

• Facts

• Rules

Thursday, August 2, 12

Page 7: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

“A computation of a logic program is a deduction of consequences of the

program. A program defines a set of consequences, which is its meaning.

The art of logic programming is constructing concise and elegant programs that have the desired

meaning.”

- The Art of Prolog

Thursday, August 2, 12

Page 8: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

Seattle.rb Pairing

Thursday, August 2, 12

Page 9: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

editor(zenspider, emacs).editor(drbrain, vim).editor(phiggins, vim).editor(tenderlove, vim).

Facts

Thursday, August 2, 12

Page 10: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

?- editor(zenspider, emacs).yes

?- editor(zenspider, vim).no

Questionseditor(zenspider, emacs).editor(drbrain, vim).

Thursday, August 2, 12

Page 11: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

?- editor(drbrain, Editor).Editor = vim

Questionseditor(zenspider, emacs).editor(drbrain, vim).

Thursday, August 2, 12

Page 12: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

editor(zenspider, emacs).editor(drbrain, vim).

?- editor(Person, Editor).Person = zenspiderEditor = emacs

Questions

Thursday, August 2, 12

Page 13: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

?- editor(Person1, vim), editor(Person2, vim),

Person1 \== Person2.Person1 = drbrainPerson2 = tenderlove

Questionseditor(zenspider, emacs).editor(drbrain, vim).editor(tenderlove, vim).

Thursday, August 2, 12

Page 14: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

?- editor(Person1, Editor), editor(Person2, Editor),

Person1 \== Person2.Editor = vimPerson1 = drbrainPerson2 = tenderlove

Questionseditor(zenspider, emacs).editor(drbrain, vim).editor(tenderlove, vim).

Thursday, August 2, 12

Page 15: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

pair(Person1, Person2) :- editor(Person1, Editor), editor(Person2, Editor), Person1 \== Person2.

Rules

?- pair(Person1, Person2).Person1 = drbrainPerson2 = tenderlove

Thursday, August 2, 12

Page 16: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

Questions & Ruleseditor(zenspider, emacs).editor(drbrain, vim).editor(tenderlove, vim).

?- pair(drbrain, Person2).Person1 = tenderlove

Thursday, August 2, 12

Page 17: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

?- pair(Person1, Person2).

Person1 = drbrainPerson2 = tenderlove ? ;

Person1 = drbrainPerson2 = phiggins ? ;

Person1 = tenderlovePerson2 = drbrain ?

Questions

Thursday, August 2, 12

Page 18: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

pair(Person1, Person2) :- editor(Person1, Editor), editor(Person2, Editor), Person1 @> Person2.

Rules

?- pair(Person1, Person2).Person1 = tenderlovePerson2 = drbrain

Thursday, August 2, 12

Page 19: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

?- pair(Person1, Person2).

Person1 = tenderlovePerson2 = drbrain ? ;

Person1 = tenderlovePerson2 = phiggins ? ;

Person1 = phigginsPerson2 = drbrain ?

Questions

Thursday, August 2, 12

Page 20: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

keyboard(zenspider, dvorak).keyboard(drbrain, dvorak).keyboard(tenderlove, qwerty).keyboard(phiggins, qwerty).

Facts

Thursday, August 2, 12

Page 21: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

?- keyboard(drbrain, Keyboard).Keyboard = dvorak

Questionskeyboard(zenspider, dvorak).keyboard(drbrain, dvorak).

Thursday, August 2, 12

Page 22: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

pair(Person1, Person2) :- keyboard(Person1, Keyboard), keyboard(Person2, Keyboard), Person1 @> Person2.

Rules

?- pair(Person1, Person2).Person1 = zenspiderPerson2 = drbrain

Thursday, August 2, 12

Page 23: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

pair(P1, P2) :- editor( P1, Editor), editor( P2, Editor), P1 @> P2.pair(P1, P2) :- keyboard(P1, Keyboard), keyboard(P2, Keyboard), P1 @> P2.

Two Rules

Thursday, August 2, 12

Page 24: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

?- pair(X, Y).

X = tenderlove, Y = drbrainX = tenderlove, Y = phigginsX = phiggins, Y = drbrainX = zenspider, Y = drbrainX = tenderlove, Y = phiggins

Questions

Thursday, August 2, 12

Page 25: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

super_pair(Person1, Person2) :- editor(Person1, Editor), editor(Person2, Editor), keyboard(Person1, Keyboard), keyboard(Person2, Keyboard), Person1 @> Person2.

Rule

Thursday, August 2, 12

Page 26: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

?- super_pair(Person1, Person2).

Person1 = tenderlovePerson2 = phiggins

Questionseditor(phiggins, vim).editor(tenderlove, vim).keyboard(tenderlove, qwerty).keyboard(phiggins, qwerty).

Thursday, August 2, 12

Page 27: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

Pattern Matching

• In prolog pattern matching is used to pass arguments.

• For example:

• human(X) will match human(bill)

• Pattern matching with variables is called unification

Thursday, August 2, 12

Page 28: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

List Basics

Thursday, August 2, 12

Page 29: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

Examples

• []

• [1, 2, 3]

• [apples, bananas]

• [1, lemon]

• [[1, lemon], [1, lime], [2, coconuts]]

Thursday, August 2, 12

Page 30: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

Heads and Tails

• [1, 2, 3]

• 1 is the head

• [2, 3] is the tail

• [H | T] (read: "H bar T")

• [H | T] matches with [1, 2, 3] as [1|[2,3]]

Thursday, August 2, 12

Page 31: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

Don't Care• ‘_’ means I don't care

• [1, _, 3] could be

• [1, 2, 3] or

• [1, pi, 3] or

• [1, [apple, pie], 3]

• 2 don't cares can refer to different values

Thursday, August 2, 12

Page 32: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

def member(x, ary) return false if ary == [] return true if ary[0] == x member(x, ary[1..-1])end

Member

Thursday, August 2, 12

Page 33: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

def member(x, ary) return false if ary == [] return true if ary[0] == x member(x, ary[1..-1])end

Member

member(H, [H | _]).member(X, [_ | T]):- member(X, T).

Thursday, August 2, 12

Page 34: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

?- member(2, [1, 2, 3]).

true

?- member(6, [1, 2, 3]).

no

Thursday, August 2, 12

Page 35: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

?- member(X, [1, 2, 3]).

X = 1 ? a

X = 2

X = 3

Thursday, August 2, 12

Page 36: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

?- member(6, X).

X = [6|_] ? ;

X = [_,6|_] ? ;

X = [_,_,6|_] ?

Variables Anywhere

Thursday, August 2, 12

Page 37: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

def length(ary) return 0 if ary == [] return length(ary[1..-1]) + 1end

Length

Thursday, August 2, 12

Page 38: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

def length(ary) return 0 if ary == [] return length(ary[1..-1]) + 1end

Length

length([], 0).length([_ | T], N) :- length(T, N1), N is N1 + 1.

Thursday, August 2, 12

Page 39: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

?- length([a, b, c, d], 4).

yes

?- length([1, 2, 3], X).

X = 3

Thursday, August 2, 12

Page 40: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

?- length(X, 2).

X = [_,_]

Thursday, August 2, 12

Page 41: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

Circuits

Thursday, August 2, 12

Page 42: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

In Outinv(0, 1).inv(1, 0).

Thursday, August 2, 12

Page 43: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

A B Outor(0, 0, 0).or(1, 0, 1).or(0, 1, 1).or(1, 1, 1).

Thursday, August 2, 12

Page 44: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

A B Outand(0, 0, 0).and(0, 1, 0).and(1, 0, 0).and(1, 1, 1).

Thursday, August 2, 12

Page 45: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

A B Outxor(0, 0, 0).xor(0, 1, 1).xor(1, 0, 1).xor(1, 1, 0).

Thursday, August 2, 12

Page 46: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

A B Outnand(0, 0, 1).nand(0, 1, 1).nand(1, 0, 1).nand(1, 1, 0).

Thursday, August 2, 12

Page 47: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

half_adder(A, B, C, S) :- xor(A, B, S), and(A, B, C).

Thursday, August 2, 12

Page 48: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

?- half_adder(A, B, C, S).

A = 0, B = 0, C = 0, S = 0

A = 0, B = 1, C = 0, S = 1

A = 1, B = 0, C = 0, S = 1

A = 1, B = 1, C = 1, S = 0

Thursday, August 2, 12

Page 49: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

full_adder(A, B, Cin, Cout, S) :- half_adder(A, B, C1, S1), half_adder(Cin, S1, C2, S), or(C1, C2, Cout).

Thursday, August 2, 12

Page 50: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

?- full_adder(A, B, 1, Cout, 1).

A = 0, B = 0, Cout = 0A = 1, B = 1, Cout = 1

? - full_adder(A, B, Cin, 1, S).

A = 0, B = 1, Cin = 1, S = 0A = 1, B = 0, Cin = 1, S = 0A = 1, B = 1, Cin = 0, S = 0A = 1, B = 1, Cin = 1, S = 1

Thursday, August 2, 12

Page 51: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

mystery(A, B, D) :- nand(A, B, T1), nand(A, T1, T2), nand(B, T1, T3), nand(T2, T3, D).

Thursday, August 2, 12

Page 52: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

?- mystery(A, B, D).

A = 0, B = 0, D = 0

A = 0, B = 1, D = 1

A = 1, B = 0, D = 1

A = 1, B = 1, D = 0

Thursday, August 2, 12

Page 53: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

Logic PuzzlesThursday, August 2, 12

Page 54: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

Apartment Building1. Adam does not live on the top floor.

2. Bill does not live on the bottom floor.

3. Cora does not live on either the top or the bottom floor.

4. Dale lives on a higher floor than does Bill.

5. Erin does not live on a floor adjacent to Cora's.

6. Cora does not live on a floor adjacent to Bill's.

Thursday, August 2, 12

Page 55: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

‘Data Structure’

• A list of the people, ordered by floor

• [Top, Floor4, Floor3, Floor2, Bottom]

• [adam, bill, cora, dale, erin]

Thursday, August 2, 12

Page 56: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

adam \== Top,

Adam does not live on the top floor.

Thursday, August 2, 12

Page 57: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

bill \== Bottom,

Bill does not live on the bottom floor.

Thursday, August 2, 12

Page 58: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

cora \== Top,cora \== Bottom,

Cora does not live on either the top or the bottom floor.

Thursday, August 2, 12

Page 59: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

higher(dale, bill, L),

Dale lives on a higher floor than does Bill.

Thursday, August 2, 12

Page 60: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

higher(X, Y, [X | T]) :- member(Y, T).

higher(X, Y, [_ | T]) :- higher(X, Y, T).

Higher

Thursday, August 2, 12

Page 61: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

not_adjacent(erin, cora, L),

Erin does not live on a floor adjacent to Cora's.

Thursday, August 2, 12

Page 62: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

not_adjacent

Thursday, August 2, 12

Page 63: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

not_adjacentnot_adjacent(X, Y, [X, Z | T]) :- Z \== Y,

member(Y, T).

Thursday, August 2, 12

Page 64: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

not_adjacent

not_adjacent(X, Y, [Y, Z | T]) :- Z \== X, member(X, T).

not_adjacent(X, Y, [X, Z | T]) :- Z \== Y,

member(Y, T).

Thursday, August 2, 12

Page 65: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

not_adjacent(X, Y, [_ | T]) :- not_adjacent(X, Y, T).

not_adjacent

not_adjacent(X, Y, [Y, Z | T]) :- Z \== X, member(X, T).

not_adjacent(X, Y, [X, Z | T]) :- Z \== Y,

member(Y, T).

Thursday, August 2, 12

Page 66: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

not_adjacent(cora, bill, L),

Cora does not live on a floor adjacent to Bill's.

Thursday, August 2, 12

Page 67: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

permutation(L, [adam, bill, cora, dale, erin]).

permutation

Thursday, August 2, 12

Page 68: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

puzzle(L) :- L = [Top, F4, F3, F2, Bottom],

Puzzle

Thursday, August 2, 12

Page 69: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

puzzle(L) :- permutation(L, [adam, bill, cora, dale, erin]), L = [Top, Floor4, Floor3, Floor2, Bottom], adam \== Top, bill \== Bottom, cora \== Top, cora \== Bottom, higher(dale, bill, L), not_adjacent(erin, cora, L), not_adjacent(cora, bill, L).

All Together

Thursday, August 2, 12

Page 70: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

| ?- puzzle([A, B, C, D, E]).

A = daleB = coraC = adamD = billE = erin ? ;

no

Running

Thursday, August 2, 12

Page 71: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

Learn More

Thursday, August 2, 12

Page 72: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

Books• Sterling, Leon & Shapiro, Ehud. The Art of Prolog

• Clocksin, William F. Clause and Effect: Prolog Programming for the Working Programmer

• Bratko, Ivan. Prolog Programming for Artificial Intelligence

• Tate, Bruce A. Seven Languages in Seven Weeks: A Pragmatic Guide to Learning Programming Languages

Thursday, August 2, 12

Page 73: A Taste of Prolog - thagomizer.com · • This is just an introduction Thursday, August 2, 12. ... • Natural Language Processing • Grammars • Theorem Proving • Expert Systems

Thank You

Thursday, August 2, 12