250 likes | 537 Views
Prolog. By: Brandon Ramsey. Designers. Founders. Alain Colmerauer with the help of Philippe Roussel developed the first Prolog system which spanned from Q-systems ( 1970) in Marseille, France . First Prolog interpreter was built by Roussel and Kowalski (1972)
E N D
Prolog By: Brandon Ramsey
Founders • Alain Colmerauer with the help of Philippe Rousseldeveloped the first Prolog system which spanned from Q-systems (1970) in Marseille, France. • First Prolog interpreter was built by Roussel and Kowalski (1972) • David Warren at the University of Edinburgh built the first Prolog compiler (for the DEC-10 machine, 1972). • Alain Colmeraur is a professor at the University of France • David Warren is currently Leading Professor of Computer Science at the University at Stony Brook where he continues his research in the area of logic programming.
Historical Background • Prolog was one of the first logic programming languages,and remains one of the most popular among such languages today. • The first Erlang interpreter was developed in Prolog by Joe Armstrong. • Prolog was inspired by the programming language which was made in 1969 by Carl Hewitt. • It also influenced Mercury, Oz, Strand, KL0, KL1, and Datalog • Huge competitor of Lisp
Historical Background • Some of the versions that were created Prolog I, Prolog II, Prolog III, Strawberry Prolog, SWI Prolog, Virtual Prolog, etc…. • Version 7.0 introduced parametric polymorphism. • Version 7.2 introduced anonymous predicates (a logical pendant to anonymous functions) and namespaces. • Version 7.3 introduced generic classes and interfaces, guarded monitors. • Version 7.4 can generate 64 bit windows code • Was originally aimed at natural processing language processing (human-computer interaction) .
What is Prolog? • A programming language used for solving problems that involve objects and the relationships between objects. • One of the most widely used languages for artificial intelligence research • Declarative programming language • That means, when implementing the solution to a problem, instead of specifying how to achieve a certain goal in a certain situation, we specify what the situation (rules and facts) and the goal (query) are and let the Prolog interpreter derive the solution for us. • Prolog is pretty useless in areas, such as graphics or numerical algorithms.
Applications • Intelligent data base retrieval • Natural language understanding • Expert systems • Specification language • Machine learning • Robot planning • Automated reasoning • Problem solving
Applications • IBM’s Watson for NLP • Prolog was also used by NASA to build a software named "clarissa", for the ISS. Clarissa is a voice user interface for browsing space station procedures. • Used in building the ICOT Fifth Generation Computer Systems Initiative. The Japanese Government developed this project in an attempt to create intelligent computers.
Main Features • based on logical programming with Horn clauses • fully object oriented • object predicate values (delegates) • algebraic data types • pattern matching and unification • controlled non-determinism • fully integrated fact databases • supports parametric polymorphism • automatic memory management • supports direct linkage with C/C++
Pattern Matching and Unification f d a Z c f X a b c Two terms unify if substitutions can be made for any variables so they are made identical.
Clauses • Prolog is declarative: the program logic is expressed in terms of relations, represented as facts and rules. • Types of clauses: Facts and rules • Head :- Body. • Clauses with empty bodies are facts • Clauses with bodies are rules • american(tony). • person(X) :- american(X).
Syntax • Names of all relationships and objects must begin with a lowercase letter • Relationship is written first, and the objects are written separated by commas enclosed by parenthesis. • Period is at the end of a fact • father(john, mary). //John is the father of Mary
Example mother_child(trude, sally). father_child(tom, sally). father_child(tom, erica). father_child(mike, tom). sibling(X, Y) :- parent_child(Z, X), parent_child(Z, Y). parent_child(X, Y) :- father_child(X, Y). parent_child(X, Y) :- mother_child(X, Y).
Example 2: Boundaries ?- is_bigger(X,donkey). X = horse X = elephant No ?- is_bigger(donkey,X), is_bigger(X, monkey). No Separate queries
Example 3: Hello World ?- write(“Hello world!”), nl. Hello world! true. ?
Example 4: Factorial factorial(0,1). factorial(X,Y) :- X1 is X - 1, factorial(X1,Z), Y is Z * X, !.
Example 5: Fibonacci fib(0,0). fib(1,1). fib(N,F) :- succ(N1,N), succ(N2,N1), fib(N1,F1), fib(N2,F2), plus(F1,F2,F).
Versatility • Frameworks exist which can bridge between Prolog and other languages • Interprolog can be used in java • C#-Prolog can be used in C# • Jekejeke Prolog API provides tightly coupled concurrent call-in and call-out facilities between Prolog and Java or Android • The LPA Intelligence Server allows the embedding of LPA Prolog within C, C#, C++, Java, VB, Delphi, .Net, Lua, Python and other languages.
Current State • Latest version Visual Prolog 7.4 (Build 7402) was released on 6/14/13 • www.visualprolog.com