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

Similar documents
Lisp and Prolog Background

Introduction to Functional Programming and basic Lisp

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

Introduction & Review

SOFTWARE ARCHITECTURE 6. LISP

Introduction. A. Bellaachia Page: 1

Functional Programming. Big Picture. Design of Programming Languages

Introduction to Logic Programming

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

Functional Programming Languages (FPL)

comparing Lisp and Prolog

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

Com S 541. Programming Languages I

Example Scheme Function: equal

Artificial Intelligence Lecture 1

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

Heap storage. Dynamic allocation and stacks are generally incompatible.

CMSC 331 Final Exam Section 0201 December 18, 2000

Modern Programming Languages. Lecture LISP Programming Language An Introduction

Programming Languages, Summary CSC419; Odelia Schwartz

A Brief Introduction to Scheme (I)

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

Introduction to Scientific Computing Languages

Chapter 15. Functional Programming Languages

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

Introduction to Scientific Computing Languages

Concepts of Programming Languages

FP Foundations, Scheme

Scheme: Expressions & Procedures

A Small Interpreted Language

Functional programming in LISP

CPS 506 Comparative Programming Languages. Programming Language Paradigm

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

History. Functional Programming. Based on Prof. Gotshalks notes on functionals. FP form. Meaningful Units of Work

Which of the following is not true of FORTRAN?

Programming Languages 2nd edition Tucker and Noonan"

Informal Semantics of Data. semantic specification names (identifiers) attributes binding declarations scope rules visibility

CS 314 Principles of Programming Languages

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

CS 415 Midterm Exam Spring 2002

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

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

Lambda Calculus see notes on Lambda Calculus

G Programming Languages Spring 2010 Lecture 6. Robert Grimm, New York University

Compilers. Prerequisites

2. Evolution of the Major Programming languages

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

Seminar in Programming Languages

15. Functional Programming

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

Chapter 1. Preliminaries

Compilation I. Hwansoo Han

Functional Programming Lecture 1: Introduction

Lecture 9: Control Flow

General Concepts. Abstraction Computational Paradigms Implementation Application Domains Influence on Success Influences on Design

Recursive Functions of Symbolic Expressions and Their Application, Part I

Functional Programming. Pure Functional Programming

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.

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG)

Continuations provide a novel way to suspend and reexecute

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

1 A question of semantics

So what does studying PL buy me?

What is a programming language?

CS 242. Fundamentals. Reading: See last slide

COMP 201: Principles of Programming

CSCI-GA Scripting Languages

LISP Programming. (23 (this is easy) hello 821)

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

CS 314 Principles of Programming Languages

Introduction to lambda calculus Part 3

Formal Verification. Lecture 10

15 Unification and Embedded Languages in Lisp

Common LISP Tutorial 1 (Basic)

Introduction to the Lambda Calculus. Chris Lomont

8/27/17. CS-3304 Introduction. What will you learn? Semester Outline. Websites INTRODUCTION TO PROGRAMMING LANGUAGES

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

Functional programming with Common Lisp

Automata and Formal Languages - CM0081 Introduction to Agda

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

Part (04) Introduction to Programming

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

Chapter 3. Semantics. Topics. Introduction. Introduction. Introduction. Introduction

Contents. Chapter 1 SPECIFYING SYNTAX 1

Declarative programming. Logic programming is a declarative style of programming.

Programmiersprachen (Programming Languages)

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

Tales from the Workshops

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

COP4020 Programming Languages. Compilers and Interpreters Robert van Engelen & Chris Lacher

Chapter 2 Preview. Preview. History of Programming Languages. History of Programming Languages. History of Programming Languages

Early computers (1940s) cost millions of dollars and were programmed in machine language. less error-prone method needed

Why are there so many programming languages? Why do we have programming languages? What is a language for? What makes a language successful?

COS 126 General Computer Science Spring Written Exam 1

CS101 Introduction to Programming Languages and Compilers

LECTURE 17. Expressions and Assignment

Chapter 2. Pseudocodes: Speedcoding. 2.2 Minimal Hardware Programming: Pseudocodes. Evolution of the Major Programming Languages

CSC 533: Programming Languages. Spring 2015

Topic I. Introduction and motivation References: Chapter 1 of Concepts in programming languages by J. C. Mitchell. CUP, 2003.

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

Transcription:

Lisp and Prolog Background Thank you to Prof. Roosen-Runge and Prof. Gotshalks for the slides that I will be using throughout the course. Lisp History Lisp - invented (about 1958) by the logician and AI researcher John McCarthy Widely used for applications in AI for over 30 years Used in industry To develop expert systems and other AI applications For Rapid Application Development (RAD) 1 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 Lisp Availability On all major and many minor platforms Numerous free and shareware versions Standard: Common Lisp 3 4

Prolog History Prolog invented ( 1972) by the AI researcher Alan Colmeraurer Widely used to develop expert systems & other AI applications including natrual language processing Used at York in the Student Information System to check applications for input errors Early ideas developed at the University of Montreal; then University of Marseilles Prolog Use and Availability Prolog rumored to be embedded in MS Office On all major and many minor platforms Several free and shareware versions Standard: 'ISO Standard' 5 6 Low and High Level (1) Lisp became the 'assembler language' - lower-level - for AI programmers Used to build higher level systems Wilensky chapters 21 and 22 give the basis for C Prolog! ommon Lisp = union of the techniques and tools people have found useful 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 7 8

Symbolic Computing Computing on non-numbers non-character-string use atoms instead of numbers and strings Building structures from atoms lists, trees, terms, clauses, propositions, etc. Operational vs Denotational Programming 9 10 Operational Programming Basic, Pascal, C, Java, etc. Require describing how something is computed Program describes a sequence of operations Not describing what is computed j <-- 1 While j max { print item (j) j <-- j + 1 Denotational Programming (1) Denotation = object described by an expression or referred to by a name Describes what to compute Denotational program has a mathematical meaning Uses mathematical objects such as functions, relations, etc. } 11 12

Denotational Programming (2) Examples of denotational languages: Lisp Prolog APL ML Timeless vs. State-change Denotational semantics uses mathematical language Timeless propositions Nothing changes x = x + 1 is false Operational semantics uses Language of states (memory) and change-of-state x x + 1 describes a change in state of x = in C/C++, Java, Fortran := in Pascal and Eiffel 13 14 Denotational 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 Denotational vs. Operational Programming Denotational: describes what to compute Operational: describes how to compute Invented the concepts of the predicate calculus and quantifiers: (for all, there exists) 15 16

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 = desription of mathematical relationship between input and output When executed, value of x equals value of y+3 17 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 18 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 palindrome 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 ) 19 20

Pure Lisp Denotational and 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 is what makes Lisp distinctive Pure Prolog 'Pure' Prolog: denotational and declarative Just 1 state T A 'knowledge' base = database for facts his turned out to be a very big advance! 21 22 Lisp vs. Prolog? Which AI language an AI researcher uses often depends on where they studied. At MIT and and Stanford, At Edinburgh, almost all almost all Lisp Prolog MIT has used a dialect of Lisp called Scheme in their first year programming course for many years. 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 23 24

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 Object-oriented add-ons available for both languages 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 25 26 General Goals Understand important ideas and historical context in computer science Extend understanding of programming concepts and vocabulary Learn to adapt to a new mindsets - actually two new mindsets! pure functional programming - Lisp declarative programming - Prolog 27