LISP and PROLOG AI Programming Language Submitted To: Dr. Hesham El-Zoka Submitted By: Eng. Ismail Fathalla El-Gayar.

Slides:



Advertisements
Similar presentations
© Johan Bos Logic Programming About the course –Taught in English –Tuesday: mostly theory –Thursday: practical work [lab] Teaching material –Learn Prolog.
Advertisements

© Patrick Blackburn, Johan Bos & Kristina Striegnitz Lecture 10: Cuts and Negation Theory –Explain how to control Prolog`s backtracking behaviour with.
First Order Logic Logic is a mathematical attempt to formalize the way we think. First-order predicate calculus was created in an attempt to mechanize.
C-LISP. LISP 2 Lisp was invented by John McCarthy in 1958 while he was at the Massachusetts Institute of Technology (MIT).John McCarthyMassachusetts Institute.
1 Scheme and Functional Programming Aaron Bloomfield CS 415 Fall 2005.
Introduction. IC-Parc2 ECLiPSe Components Constraint Logic Programming system, consisting of  A runtime core Data-driven computation, backtracking, garbage.
© Patrick Blackburn, Johan Bos & Kristina Striegnitz Lecture 6: More Lists Theory –Define append/3, a predicate for concatenating two lists, and illustrate.
LING 388: Language and Computers Sandiway Fong Lecture 5: 9/5.
Introduction to PROLOG ME 409 Lab - 1. Introduction to PROLOG.
© Patrick Blackburn, Johan Bos & Kristina Striegnitz Lecture 6: More Lists Theory –Define append/3, a predicate for concatenating two lists, and illustrate.
Prolog: List © Patrick Blackburn, Johan Bos & Kristina Striegnitz.
LING 388: Language and Computers Sandiway Fong Lecture 5: 9/8.
1 Basic Prolog ?- prolog prompt A :- B IMPLIES in rules; if B then A, logical AND ; logical OR -> if-then-else. END of predicate switch query/database.
1 Introduction to Prolog References: – – Bratko, I., Prolog Programming.
Getting started with ML ML is a functional programming language. ML is statically typed: The types of literals, values, expressions and functions in a.
Declarative Programming Autumn 2014 Introduction.
Chapter 3 Functional Programming. Outline Introduction to functional programming Scheme: an untyped functional programming language.
Declarative Programming Autumn 2014 Basic syntax and sample programs.
For Friday Read “lectures” 1-5 of Learn Prolog Now: prolog-now/
© Patrick Blackburn, Johan Bos & Kristina Striegnitz Logic Programming About the course –Taught in English –Tuesday: mostly theory –Thursday: practical.
Programming Language Semantics Mooly SagivEran Yahav Schrirber 317Open space html://
Symbolic AI Lecture Every Monday 12:30-13:30 Lab Session (two groups) Tuesday 16:30 3P30 Tuesday 17:30 3P30.
© Patrick Blackburn, Johan Bos & Kristina Striegnitz Lecture 9: A closer look at terms Theory –Introduce the == predicate –Take a closer look at term structure.
Semantics with Applications Mooly Sagiv Schrirber html:// Textbooks:Winskel The.
JavaScript, Third Edition
© Patrick Blackburn, Johan Bos & Kristina Striegnitz Lecture 4: Lists Theory –Introduce lists, an important recursive data structure often used in Prolog.
(9.1) COEN Logic Programming  Logic programming and predicate calculus  Prolog statements  Facts and rules  Matching  Subgoals and backtracking.
Formal Models of Computation Part II The Logic Model
Notes for Chapter 12 Logic Programming The AI War Basic Concepts of Logic Programming Prolog Review questions.
Logic Programming Programming Lecture 1: Getting started with Prolog.
CSC3315 (Spring 2009)1 CSC 3315 Programming Paradigms Scheme Language Hamid Harroud School of Science and Engineering, Akhawayn University
programmation en logique
1-1 Introduction Logic programming languages, sometimes called declarative programming languages Express programs in a form of symbolic logic Use a logical.
110/19/2015CS360 AI & Robotics AI Application Areas  Neural Networks and Genetic Algorithms  These model the structure of neurons in the brain  Humans.
For Wednesday Read “lectures” 7-10 of Learn Prolog Now Chapter 9, exs 4 and 6. –6 must be in Horn clause form Prolog Handout 2.
Kansas State University Department of Computing and Information Sciences CIS 730: Introduction to Artificial Intelligence Lecture 17 Wednesday, 01 October.
3.2 Semantics. 2 Semantics Attribute Grammars The Meanings of Programs: Semantics Sebesta Chapter 3.
The AI War LISP and Prolog Basic Concepts of Logic Programming
Logic Programming Languages Session 13 Course : T Programming Language Concept Year : February 2011.
Automated Reasoning Early AI explored how to automated several reasoning tasks – these were solved by what we might call weak problem solving methods as.
Ch. 13 Ch. 131 jcmt CSE 3302 Programming Languages CSE3302 Programming Languages (notes?) Dr. Carter Tiernan.
Assignment statement: Assigns a value to a variable Variable must appear on the left side, value on the right side of the assignment operator Right side.
Logical and Functional Programming
Introduction to Prolog. Outline What is Prolog? Prolog basics Prolog Demo Syntax: –Atoms and Variables –Complex Terms –Facts & Queries –Rules Examples.
Programming Languages Third Edition Chapter 4 Logic Programming.
CSE 3302 Programming Languages Chengkai Li Spring 2008 Logic Programming: Prolog Lecture 21 – Prolog, Spring CSE3302 Programming Languages, UT-Arlington.
Principle of Programming Lanugages 3: Compilation of statements Statements in C Assertion Hoare logic Department of Information Science and Engineering.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 1 Overview A good programming language is.
LING/C SC/PSYC 438/538 Lecture 15 Sandiway Fong. Did you install SWI Prolog?
Logic Programming Dr. Yasser Nada Fall 2010/2011 Lecture 1 1 Logic Programming.
Boolean expressions, part 1: Compare operators. Compare operators Compare operators compare 2 numerical values and return a Boolean (logical) value A.
In The Name Of Allah Lab 03 1Tahani Aldweesh. objectives Searching for the solution’s. Declaration. Query. Comments. Prolog Concepts. Unification. Disjunction.
For Friday No reading Prolog Handout 2. Homework.
CMSC 330: Organization of Programming Languages Operational Semantics.
Abdul Rahim Ahmad MITM 613 Intelligent System Chapter 10: Tools.
Chapter 2 Syntax and meaning of prolog programs Part 1.
Done By :- -Nesreen Basem -Sara nabil -Rawan Prolog Program.
Prolog Fundamentals. 2 Review Last Lecture A Prolog program consists of a database of facts and rules, and queries (questions). –Fact:.... –Rule:... :-....
Ch Ch jcmt CSE 3302 Programming Languages CSE3302 Programming Languages (n-n-n-notes) Summer 2003 Dr. Carter Tiernan.
Programming Languages 2nd edition Tucker and Noonan
Functional Programming
Artificial intelligence (AI)
Expressions and Assignment
GC211Data Structure Lecture2 Sara Alhajjam.
CSE 311 Foundations of Computing I
Back to “Serious” Topics…
Chapter 2 Syntax and meaning of prolog programs
Course Overview PART I: overview material PART II: inside a compiler
Representations & Reasoning Systems (RRS) (2.2)
PROLOG.
Presentation transcript:

LISP and PROLOG AI Programming Language Submitted To: Dr. Hesham El-Zoka Submitted By: Eng. Ismail Fathalla El-Gayar

AI Programming Languages

FeaturesYearLanguage support programs that could perform general problem solving, including lists, associations, schemas (frames), dynamic memory allocation, data types, recursion,, functions as arguments, and cooperative multitasking Information Processing Language IPL practical mathematical notation for computer programs based on lambda calculus. Linked lists are one of Lisp languages' major data structures LISt Processing 1958, LISP is a hybrid between procedural and logical languages. It gives a procedural interpretation to logical sentences where implications are interpreted with pattern-directed inference. MIT 1969PLANNER declarative language where programs are expressed in terms of relations, and execution occurs by running queries over these relations. Prolog is particularly useful for symbolic reasoning, database and language parsing applications. programmatio n en logique 1970s PROLOG language for expressing automated planning problem instances Stanford Research Institute Problem Solver1971 STRIPS

So Why We Learn Logic Programming Languages???

System Usability PROLOG has many denotation, functional languages other than Lisp

System Usability Why Prolog here? 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

System Usability Why Prolog here? 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

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

System Usability LISP & PROLOG Programming Language

Atom: One Component Out Of List ex: x, y, k LIST: Brackets Containing Atom ex: ( 2 3 x ) ATOM & LIST

PROLOGLISP Point Of Comparison 2+3(+ 2 3)Add (5-2)(- 5 2)Subtract (2*3)(* 3 2)Multiplication (6/2)(/ 6 2)Division ( 3 + (3 * 2) + 4 )(+ 3 (* 3 2) 4)braces Arithmetic Operations

PROLOGLISP Point Of Comparison 3<4 Yes (< 3 4) True Smaller 2>5 no (> 2 5) Nil Greater 3 =<2 no (<= 3 2) Nil Smaller than or equal 6=>2 Yes (>= 6 2) True Greater than or equal 3 =:= 4 no (= 3 4) Nil Equal 3 =\= 4 yes (\= 3 4) True Not Equal Logic Operations

PROLOGLISP Point Of Comparison max([1,2,4,6,53,0],X). X=53 ( max ) 53 Max min([1,2,46,53,0],X). X = 0 ( min ) 0 Min sum(X,Y,Z)plus(A, B, C) C is A + B. Sum Functions the both languages are Object Oriented Programming Languages

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)) - ( )  10 - (if nil (list 1 2 "foo") (list 3 4"bar"))  if (var)=nill Do (1 2 Foo) else (3 4 bar) List Processing Language

Lambda(to assign A variable) (lambda (arg) (+ arg 1)) =>arg=arg+1 ((lambda (arg) (+ arg 1)) 5) =>arg =6 List Processing Language

Example : [mia, vincent, jules, yolanda] Dealing With List: [Head| Tail] = [mia, vincent, jules, yolanda] means:- Head = mia Tail = [vincent,jules,yolanda] yes Lists In PROLOG

Example: Concatenation 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 an imperative language In a declarative language In a functional language cat(a,b)  if b = nil then a else cons(head(a), cat(tail(a),b)) cat([], Z, Z). cat([H|T], L, [H|Z]) :- cat(T, L, Z).

Example in PROLOG ( Fact&Rule) elephant(george). elephant(mary). elephant(X) :- grey(X), mammal(X), hasTrunk(X). Procedure for elephant Predicate Clauses Rule Facts

Example in PROLOG ( Fact&Rule) ?- elephant(george). yes ?- elephant(jane). no Queries Replies

Execution of Prolog Programs 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

Applications of Prolog:- Expert systems Relational database queries Parsing of context-free languages Natural language processing Teaching programming, as early as in grade school

LISP Compiler BEE POPLOG LISP WORKS GNU C LISP PROLOG Compiler B-Prolog GNU Prolog C# PROLOG Open Prolog Strawberry Prolog

Paul Brna,Prolog Programming A First Course. Fernando C. N. Pereira, Stuart M. Shieber,Prolog and Natural Language Analysis. Ulf Nilsson, Jan Maluszynski,Logic Programming and Prolog 2 nd edition. Amzi,Adventure in Prolog. - Patrick Blackburn, Johan Bos, Kristina Striegnitz, Learn Prolog Now! References