Lisp and Prolog Background

Similar documents
Lisp History. Lisp and Prolog Background. Lisp Use. Lisp Availability

Introduction to Functional Programming and basic Lisp

Introduction to LISP. York University Department of Computer Science and Engineering. York University- CSE V.

Introduction & Review

Functional Programming. Big Picture. Design of Programming Languages

A Brief Introduction to Scheme (I)

SOFTWARE ARCHITECTURE 6. LISP

Modern Programming Languages. Lecture LISP Programming Language An Introduction

Scheme: Expressions & Procedures

Functional Programming Languages (FPL)

Introduction to Logic Programming

comparing Lisp and Prolog

Plan of the lecture. G53RDB: Theory of Relational Databases Lecture 1. Textbook. Practicalities: assessment. Aims and objectives of the course

Introduction. A. Bellaachia Page: 1

A Small Interpreted Language

Example Scheme Function: equal

As Natural as 0, 1, 2. Philip Wadler University of Edinburgh

CIS24 Project #3. Student Name: Chun Chung Cheung Course Section: SA Date: 4/28/2003 Professor: Kopec. Subject: Functional Programming Language (ML)

Artificial Intelligence Lecture 1

Functional Programming Lecture 1: Introduction

λ calculus Function application Untyped λ-calculus - Basic Idea Terms, Variables, Syntax β reduction Advanced Formal Methods

Functional Programming. Pure Functional Programming

Com S 541. Programming Languages I

15 Unification and Embedded Languages in Lisp

CSC 533: Programming Languages. Spring 2015

PROGRAMMING LANGUAGE PARADIGMS & THE MAIN PRINCIPLES OF OBJECT-ORIENTED PROGRAMMING

INF4820: Algorithms for Artificial Intelligence and Natural Language Processing. Common Lisp Fundamentals

9/19/12. Why Study Discrete Math? What is discrete? Sets (Rosen, Chapter 2) can be described by discrete math TOPICS

CSc 372. Comparative Programming Languages. 2 : Functional Programming. Department of Computer Science University of Arizona

Contents. Chapter 1 SPECIFYING SYNTAX 1

1. true / false By a compiler we mean a program that translates to code that will run natively on some machine.

Functional Programming

Lecture 5: The Halting Problem. Michael Beeson

Fundamentals of Artificial Intelligence COMP221: Functional Programming in Scheme (and LISP)

15. Functional Programming

CSCE 314 TAMU Fall CSCE 314: Programming Languages Dr. Flemming Andersen. Haskell Basics

What is a programming language?

Automata and Formal Languages - CM0081 Introduction to Agda

Functional programming in LISP

Heap storage. Dynamic allocation and stacks are generally incompatible.

A Prolog-based Proof Tool for Type Theory TA λ and Implicational Intuitionistic-Logic

Functional programming with Common Lisp

11/6/17. Functional programming. FP Foundations, Scheme (2) LISP Data Types. LISP Data Types. LISP Data Types. Scheme. LISP: John McCarthy 1958 MIT

Introduction to the Lambda Calculus. Chris Lomont

Chapter 15. Functional Programming Languages

Chapter 11 :: Functional Languages

1 A question of semantics

Seminar in Programming Languages

THE FOUNDATIONS OF MATHEMATICS

CPS 506 Comparative Programming Languages. Programming Language Paradigm

CSCE 314 Programming Languages

The discussion of Chapter 1 will be split into two sessions; the first will cover 1.1 and 1.2; the second will cover 1.3, 1.4, and 1.5.

Functional Programming with Common Lisp

Midterm CSE 21 Spring 2012

Why study Programming Language Concepts? Chapter One. Language Evaluation Criteria. Programming Domains. Readability Writability Reliability Cost

Formal Verification. Lecture 10

Formal Specification: Z Notation. CITS5501 Software Testing and Quality Assurance

Introduction. chapter Functions

A Theory of Parallel Computation The π-calculus

COS 126 General Computer Science Spring Written Exam 1

CS 242. Fundamentals. Reading: See last slide

Logic as a Programming Language

One of the main selling points of a database engine is the ability to make declarative queries---like SQL---that specify what should be done while

LECTURE 16. Functional Programming

Functional Languages. CSE 307 Principles of Programming Languages Stony Brook University

The design of a programming language for provably correct programs: success and failure

SJTU SUMMER 2014 SOFTWARE FOUNDATIONS. Dr. Michael Clarkson

Welcome to. Instructor Marc Pomplun CS 470/670. Introduction to Artificial Intelligence 1/26/2016. Spring Selectivity in Complex Scenes

The Design and Implementation of a Modern Lisp. Dialect

Language Translation, History. CS152. Chris Pollett. Sep. 3, 2008.

So what does studying PL buy me?

Overview. CS389L: Automated Logical Reasoning. Lecture 6: First Order Logic Syntax and Semantics. Constants in First-Order Logic.

FP Foundations, Scheme

A Modern Perspective on Type Theory

Logical Methods in... using Haskell Getting Started

Lambda Calculus and Lambda notation in Lisp II. Based on Prof. Gotshalks notes on Lambda Calculus and Chapter 9 in Wilensky.

7. Introduction to Denotational Semantics. Oscar Nierstrasz

Semantics via Syntax. f (4) = if define f (x) =2 x + 55.

Organization of Programming Languages CS3200/5200N. Lecture 11

CS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University

Type Systems COMP 311 Rice University Houston, Texas

Part (04) Introduction to Programming

Recursive Functions of Symbolic Expressions and Their Application, Part I

Section 10: LISP to Scheme. Evolution of Software Languages

The Logic Paradigm. Joseph Spring. 7COM1023 Programming Paradigms

CS 565: Programming Languages. Spring 2008 Tu, Th: 16:30-17:45 Room LWSN 1106

This is already grossly inconvenient in present formalisms. Why do we want to make this convenient? GENERAL GOALS

1.3. Conditional expressions To express case distinctions like

Chapter 2. 5 * B => A V 6 7 (subscripts) S 1.n 1.n (data types)

Introduction to lambda calculus Part 3

Programming Language Concepts: Lecture 14

An Industrially Useful Prover

Unit 4 Relational Algebra (Using SQL DML Syntax): Data Manipulation Language For Relations Zvi M. Kedem 1

Scheme: Data. CS F331 Programming Languages CSCE A331 Programming Language Concepts Lecture Slides Monday, April 3, Glenn G.

2. Evolution of the Major Programming languages

Functional Programming Principles in Scala. Martin Odersky

Continuations provide a novel way to suspend and reexecute

Notes for Chapter 12 Logic Programming. The AI War Basic Concepts of Logic Programming Prolog Review questions

CS 342 Lecture 6 Scheme Procedures and Closures By: Hridesh Rajan

Prolog Introduction. Gunnar Gotshalks PI-1

Transcription:

Lisp and Prolog Background Thank you to Prof. Roosen-Runge for the slides on background and history. BH2-1

Lisp History Lisp--invented (about 1958) by the logician and AI researcher John McCarthy Widely used in for applications in AI for over 30 years Used in industry È To develop expert systems & other AI applications È For Rapid Application Development (RAD) BH2-2

Lisp Use Lisp is used as an embedded language Found inside applications like Emacs (MLisp) and AutoCAD (AutoLisp). È Emacs supports Lisp as a language for developing programs È As well as embedded language for controlling and customizing the editor itself BH2-3

Lisp availability On all major and many minor platforms. Numerous free- and shareware versions. Standard: Common Lisp BH2-4

Prolog history Prolog invented ( 1972) by the AI researcher Alan Colmeraurer È Used at York in the Student Information System to check applications for input errors Widely used to develop expert systems & other AI applications including natural language processing È Early ideas developed at University of Montreal; then University of Marseilles BH2-5

Prolog Use & Availability Prolog rumored to be embedded in MS Office On all major and many minor platforms Several free and shareware versions Standard: Edinburgh-style BH2-6

Survival Value McCarthy's Lisp versus Newell's IPL (Information Processing Language) È Both men pioneers in AI and computer science È Both proposed languages at about the same time for symbolic computing to be used in AI research BH2-7

& the winner is? McCarthy? Newell? Why? BH2-8

& the winner is... Value of high-level over low-level language wasn t so clearly recognized in the early days. Newell made what turned out to be a fatal error for his language Newell modelled IPL, not on logic, but on assembler language. This made his language very operational Couldn't be understood in mathematical terms. Wasn't accepted as a notation for AI programs. BH2-9

Low- and High-level Ð 1 Lisp became the assembler language lower-level for AI programmers È Used to build higher-level systems È Wilensky Chapters 21 & 22 give the basis for Prolog! Common Lisp = union of the techniques and tools people have found useful. BH2-10

Low- and High-level Ð 2 Prolog is a higher-level language for knowledge-based programming È More powerful, not necessarily as efficient È More compact È More understandable programs. BH2-11

Denotational vs Operational Programming BH2-12

What is a Denotation? Denotation = object described by an expression or referred to by a name. In denotational programming languages, the object is mathematical È number È abstract symbol È function È equation or proposition BH2-13

Denotation History Concept of denotation comes from the theories of how logic connects to mathematics worked out by Bertrand Russell & Albert North Whitehead at the turn of the century (famous book: Principia Mathematica) Based on ideas from German logician Gottlob Frege Invented the concepts of the predicate calculus and quantifiers: (for all, there exists) BH2-14

Description and Prescription Programs are both descriptions and prescriptions x = y + 3 interpreted operationally (prescription) program = instructions to underlying machine as to what to do Add 3 to y and store result in x Interpreted denotationally (description) program = description of mathematical relationship between input and output. When executed, value of x equals value of y + 3 BH2-15

Prescription Example palindrome ( String x ) : boolean is int half x.length div 2 for i : 0.. half do if x.charat ( i ) x.charat ( x.length 1 i ) ) return false fi end for return true end palindrome BH2-16

Description Example // Given the following two functions. // Result = (x = y) match ( String x, String y ) : boolean // Result is the string reversal of x. reverse ( String x ) : String // Then... palindrome ( String x ) : boolean is return match ( x, reverse (x) ) end panlindrome BH2-17

Functional vs. Declarative Functional (Lisp-like) È palindrome ( x ) is x = rev (x) where rev ( [] ) is [] -- reversal of empty is empty and rev ( w ^ x ) is append ( rev (x), w ) Declarative (Prolog-like) È palindrome ( x ) if rev ( x, x ) where rev ( [], [] ) -- Empty is the reversal of empty and rev ( w ^ x, y ) if rev (x, z) and append ( z, w, y ) BH2-18

Pure Lisp Denotational, functional rather than operational È No states: just a mapping between arguments and result or, from input to output. Pure Lisp is all we will have time to discuss in this course È It's what makes Lisp distinctive BH2-19

Pure Prolog Pure Prolog: denotational & declarative Just 1 state È A knowledge base = database for facts This turned out to be a very big advance! BH2-20

Lisp vs. Prolog? Which AI language an AI researcher uses often depends on where they studied. At MIT and Stanford, almost all Lisp At Edinburgh, almost all Prolog MIT has used a dialect of Lisp called Scheme in their first year programming course for many years. BH2-21

At York We have been more a Prolog shop than a Lisp shop in this department. Prof. Stachniak teaches a 4th year course on Logic Programming which includes a more advanced look at Prolog. BH2-22

Other Choices There are many denotational, functional languages other than Lisp È ML is popular in British and some European universities American universities tend to use Lisp No strong competitors to Prolog at present, mainly variants, extensions, and dialects. Objected-oriented add-ons available for both languages BH2-23

Lisp in Production Work Programmers tend to use operational features This is not good; it is the fault of poor softwaredevelopment tools There are claims that 90% of function calls in Lisp programs are to assignment functions like setq and rplaca! Assignment changes state and is sure sign of an operational description Compare the palindrome programs BH2-24