LISP and PROLOG are early AI programming languages. LISP, created in 1958, uses lists and is functional while PROLOG, created in the 1970s, is logic-based and declarative. Both use recursion and allow programming with lists. They are commonly used for symbolic reasoning, knowledge representation and natural language processing. While different in approach, they both allow developing AI systems through a non-procedural programming style.
Introduces LISP and PROLOG as AI programming languages, acknowledging Dr. Hesham El-Zoka as the supervisor and Eng. Ismail Fathalla El-Gayar as the presenter.
Highlights the category of AI programming languages, setting the context for the discussion on LISP and PROLOG.
Details multiple AI programming languages like IPL, LISP, PLANNER, and PROLOG, outlining key features, historical context, and their capabilities.
Discusses the usability of PROLOG, its distinct paradigm compared to other languages, and its integration with Java for handling complex logical algorithms.
Compares arithmetic and logic operations in LISP and PROLOG, illustrating syntax differences in performing basic calculations and logical comparisons.
Contrasts function implementations in LISP and PROLOG, noting their programming paradigms and similarities as Object Oriented Programming languages.
Explains list processing capabilities in LISP and PROLOG, demonstrating syntax and operations for handling lists, functions, and lambda expressions.
Provides examples of list concatenation and Prolog fact/rule structures, illustrating Prolog's execution process and logic programming model.
Lists practical applications of Prolog in various domains and outlines available compilers for both LISP and PROLOG programming languages.
Lists references and resources for further reading on Prolog and LISP programming, including books and online materials.
Language Year Features IPL Information support programs that could perform general problem Processing solving, including lists, associations, schemas Language (frames), dynamic memory allocation, data types, recursion,, functions as arguments, and cooperative multitasking LISP LISt Processing practical mathematical notation for computer programs based on lambda calculus. Linked lists are one of Lisp languages' major data structures PLANNER MIT 1969 is a hybrid between procedural and logical languages. It gives a procedural interpretation to logical sentences where implications are interpreted with pattern-directed inference. PROLOG programmatio declarative language where programs are expressed in terms n en logique of relations, and execution occurs by running queries over 1970s these relations. Prolog is particularly useful for symbolic reasoning, database and language parsing applications. STRIPS Stanford Research language for expressing automated planning problem Institute Problem instances Solver1971
5.
System Usability P RO L O G has many denotation, functional languages other than Lisp
6.
Why Prolog here? System Usability • It is a particularly interesting language - the “feeling” is completely different from Java,C,... - forces to see programming in a different way - programming as writing a “logic theory” • Recently, renewed interest in Prolog in order to rapidly prototype: – complex algorithms, reasoning-like computations, dynamic structures, XML-like features – governing interaction inside system infrastructures
7.
System Usability Why Prologhere? Conceptual reasons: • new programming idiom – programming is NOT writing in Java language • Prolog as an “engine” to study models and language Practical reasons: • integration between Prolog and Java – Java as the part handling more “in-the-large” aspects network, graphics, connection with the O.S. and libraries – Prolog as the engine to handle (complex) algorithms optimization algorithms, reasoning, core logic, data structures
8.
System Usability Comparing Java/ Prolog • Java (C,C++) forces a procedural and deterministic view over computation • Prolog allows for a more declarative way of programming – expressing the problem, not the solution! – it works very well when finding solutions is “exploring a tree”. • Other applications – dealing with knowledge representation and knowledge inference, typical use in AI
Logic Operations Point Of Comparison LISP PROLOG Smaller (< 3 4) 3<4 True Yes Greater (> 2 5) 2>5 Nil no Smaller than or (<= 3 2) 3 =<2 equal Nil no Greater than or (>= 6 2) 6=>2 equal True Yes Equal (= 3 4) 3 =:= 4 Nil no Not Equal (= 3 4) 3==4 True yes
13.
Functions PointOf Comparison LISP PROLOG Max ( max 1 2 4 6 53 0 ) max([1,2,4,6,53,0],X). 53 X=53 Min ( min 1 2 4 6 53 0 ) min([1,2,46,53,0],X). 0 X=0 Sum plus(A, B, C) sum(X,Y,Z) C is A + B. the both languages are Object Oriented Programming Languages
14.
List Processing Language •Since We Said that Lisp Is A List Processing Language we will talk about how we deals with List:- -(list '1 '2 'foo) ( 1 2 Foo ) - list 1 2 (list 3 4)) => ( 1 2 (3 4)) - ( + 1 2 3 4) 10 - (if nil (list 1 2 "foo") (list 3 4"bar")) if (var)=nill Do (1 2 Foo) else (3 4 bar)
15.
List Processing Language •Lambda(to assign A variable) (lambda (arg) (+ arg 1)) =>arg=arg+1 ((lambda (arg) (+ arg 1)) 5) =>arg =6
16.
Lists In PROLOG •Example : [mia, vincent, jules, yolanda] • Dealing With List: [Head| Tail] = [mia, vincent, jules, yolanda] means:- Head = mia Tail = [vincent,jules,yolanda] yes
17.
Example: Concatenation In animperative language list procedure cat(list a, list b) { list t = list u = copylist(a); while (t.tail != nil) t = t.tail; t.tail = b; return u; } In a functional language cat(a,b) if b = nil then a else cons(head(a), cat(tail(a),b)) In a declarative language cat([], Z, Z). cat([H|T], L, [H|Z]) :- cat(T, L, Z).
18.
Example in PROLOG( Fact&Rule) Predicate Procedure for elephant Facts elephant(george). Clauses elephant(mary). elephant(X) :- grey(X), mammal(X), hasTrunk(X). Rule
19.
Example in PROLOG( Fact&Rule) ?- elephant(george). Queries yes ?- elephant(jane). Replies no
20.
Execution of PrologPrograms •Prove that goal is satisfiable •Search of facts/rules is top-down •Execution of sub-goals is left to right •Closed-world assumption: – anything not in database is false •Integer calculation, I/O don’t fit well into logical proof search
21.
Applications of Prolog:- •Expertsystems •Relational database queries •Parsing of context-free languages •Natural language processing •Teaching programming , as early as in grade school
22.
LISP Compiler PROLOG Compiler •BEE •B-Prolog •POPLOG •GNU Prolog •LISP WORKS •C# PROLOG •GNU C LISP •Open Prolog •Strawberry Prolog
23.
References •Paul Brna ,PrologProgramming A First Course. •Fernando C. N. Pereira , Stuart M. Shieber ,Prolog and Natural Language Analysis. • Ulf Nilsson , Jan Maluszynski ,Logic Programming and Prolog 2nd edition. • Amzi ,Adventure in Prolog. •- Patrick Blackburn, Johan Bos , Kristina Striegnitz , Learn Prolog Now! •http://en.wikibooks.org/wiki/Prolog/Math,_Functions_and_Equality •http://en.wikipedia.org/wiki/Prolog •http://en.wikipedia.org/wiki/Lisp_(programming_language)