0% found this document useful (0 votes)
43 views

Lisp Sli

This document discusses the history of Lisp and ideas for programming languages. It notes that Lisp was originally created in 1958 at MIT to combine list processing with ideas from symbolic logic. It was intended for AI programming and used recursion. Some key aspects of Lisp discussed include Lisp lists representing symbolic expressions, programs being data, and properties being describable by first-order reasoning. Examples of functional Lisp programs are provided. The document also discusses other languages taking aspects of Lisp but not imitating Lisp's treatment of programs as data. A new programming language called Elephant is proposed for specifying commitments in programs.

Uploaded by

claricardo
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views

Lisp Sli

This document discusses the history of Lisp and ideas for programming languages. It notes that Lisp was originally created in 1958 at MIT to combine list processing with ideas from symbolic logic. It was intended for AI programming and used recursion. Some key aspects of Lisp discussed include Lisp lists representing symbolic expressions, programs being data, and properties being describable by first-order reasoning. Examples of functional Lisp programs are provided. The document also discusses other languages taking aspects of Lisp but not imitating Lisp's treatment of programs as data. A new programming language called Elephant is proposed for specifying commitments in programs.

Uploaded by

claricardo
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

SOME LISP HISTORY AND SOME PROGRAM

LANGUAGE IDEAS
John McCarthy, Stanford University
Berlin, 2002 June 19

• I suppose I’m here because of Lisp, although I hav


involved in the Lisp community for a very long time.

• Lisp is actively used, e.g. on the Deep Space 1 spac


in the Orbitz airline reservation system, but I don’t
details.

• Fritz Kunze’s Franz Inc. makes quite a good com


called Allegro Common Lisp.
• Some important aspects of Lisp are not availabl
programming languages and systems. I don’t know
used in the above applications.

• The original idea was to combine 1956 list processin


by Newell, Simon and Shaw with ideas from John Bac
tran.

• Herbert Gelernter at IBM undertook to implement M


sky’s idea for a plane geometry theorem prover, and
list processing in Fortran. Gelernter and Carl Gerbe
oped FLPL.

• In 1958 Lisp was started at M.I.T. using recursion,


not feasible in Fortran. Lisp was intended for AI prog
• Lisp was intended to be compiled at first. Howeve
a universal Lisp function eval in 1959 to show that L
neater language for computability theory than Turing
Steve Russell pointed out that the universal function
taken as an interpreter for pure Lisp, and hand-com
IBM 704 machine language.
DIFFERENTIATION—the motivating examp

The following example motivated

• recursion using conditional expressions

• lisp notation for algebraic expressions

• allowing functions as arguments with λ-expression s

diff(e, v) ← if at e then
[if e = v then 1 else 0 ]
else if car e = P LU S then P LU S . maplist(cdr e, λu.dif f
else if car e = T IM ES then P LU S . maplist(cdr e, λu
maplist(cdr e, λw. if u eq w then dif f (car u, v) else
ASPECTS OF LISP

• Lisp lists including lists of list are the appropriate repr


of symbolic expressions for computation—better than
and better than XML.

• Lisp programs are Lisp data. Put abstractly, Lisp has


for its own abstract syntax.

• Lisp programs, most conveniently pure Lisp funct


grams, are are described extensionally by first order s

• Many important properties of the functions can be


first order reasoning.

• Other important properties require derived function


EXAMPLES OF LISP FUNCTIONAL PROGRA


(defun append (u v)
(if
(null u)
v
(cons (car u) (append (cdr u) v))))

• u ∗ v ← if n u then v else a u . [d u ∗ v] is a
functional program.

• (∀u v)(u ∗′ v = if n u then v else a u . [d u ∗


equation for the function computed by the program.
correspondence is very convenient but sometimes con
• The pure Lisp functional program as an equation pe
venient proofs in a first order theory that Lisp progr
their specifications. For example, it is easy to prove
duction that

∀u v.(u ∗ v) ∗ w = u ∗ (v ∗ w)), i.e. that appending


associative operation.
LISP AND OTHER LANGUAGES

• Garbage collection, conditional expressions and rec


grams have been taken into other languages.

• LISP data structures have been imitated clumsily in

(BUY item1 Item2 Item3)

<BUY> item1 item2 item3 </BUY>

• LISP programs having access to the abstract syn


program has not been imitated. This represents a lac
ination, but I admit I don’t have convincing examples
DERIVED FUNCTIONS

The computational cost of a Lisp functional recursiv


is not determined by the extension of the function. W
f 91(x) ← if x > 100 then x − 10 else f 91(f 91(x + 11
and f f 91(x) ← if x > 100 then x − 10 else 91.

We have ∀x.f 91′(x) = f f 91′ (x)), but clearly the func


grams are different computationally. Suppose we are
in how many times the + operation is executed in
f 91(x). This is given by f 91p′ (x), where

f 91p(x) ← if x > 100 then 0 else 1 + f 91p(f 91(x


f 91p(x + 11).
ELEPHANT 2000: a programming language for the
www.formal.stanford.edu/jmc/elephant.htm

• An elephant never forgets. An Elephant program


“A passenger has a reservation in a situation s if he h
reservation and not cancelled it. The Elephant program
specify a data structure to remember reservations. Th
must provide the necessary data structures so that
passenger has a reservation can be determined.

Has(passenger, reservation, s) ≡
(∃s′ < s)Occurs(M akes(passenger, reservation), s)
∧¬(∃s′′)(s < s′′ < s′ ∧ Occurs(Cancel(P assenger, reserv
• An elephant is faithful one hundred percent. A r
is a promise to let the passenger on the airplane if h
when he shows up. One kind of Elephant output stat
promise, and correct Elephant programs fulfill their p

• The Elephant language includes program stateme


commitments generalizing Floyd assertions, because
refer to the future, A correct Elephant program fulfil
mitments.

(∀s > N ow)(V alue(X, s) > V alue(X, N ow))


• Elephant i-o input output statments are speech acts,
tions, requests, acceptances of proposals, answers to
Answers to questions should be true and responsive.
ALGOL 48

If we introduce time explicitly as distinct from the


counter, Algolic programs can be written as sets of
Here’s an Algol 60 program for computing the prod
two natural numbers.

start :
i := n;
p := 0;
loop : if i = 0 then go to done;
i := i − 1;
goto loop;
done :
Here’s what mathematicians might have written in 19
programming languages existed.

pc(0) = 0;
i(t + 1) = if pc(t) =
else if pc(t) = 4 then i(t) − 1 else i(t);
p(t + 1) = if pc(t) =
else if pc(t) = 5 then p(t) + m else p(t)
pc(t + 1) = if pc(t) =
else if pc(t) = 5 then 2 else pc(t) + 1;
The proof that ∃t.(t ≥ 0 ∧ pc(t) = 6 ∧ p(t) = mn) fo
the sentences expressing the program and the laws of a
i.e. no theory of program correctness is needed. Ho
proof ideas are essentially the same as those used to
an algolic program terminates and that the outputs
correct relation to the inputs. Amir Pnueli and Nissi
had this idea before I did, but they mistakenly aband
temporal logic.

You might also like